{"size": 1448, "ext": "js", "max_stars_repo_path": "test/linters/params/flake8.js", "max_stars_repo_name": "eMerzh/lint-action", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/linters/params/flake8.js", "max_issues_repo_name": "eMerzh/lint-action", "max_issues_repo_issues_event_min_datetime": "2020-02-10T15:24:49.000Z", "max_issues_repo_issues_event_max_datetime": "2020-02-10T15:24:49.000Z", "max_forks_repo_path": "test/linters/params/flake8.js", "max_forks_repo_name": "eMerzh/lint-action", "max_forks_repo_forks_event_min_datetime": "2021-02-10T19:20:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-10T19:20:09.000Z"}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 27.320754717, "max_line_length": 170, "alphanum_fraction": 0.6408839779}
const { EOL } = require("os");
const { sep } = require("path");

const Flake8 = require("../../../src/linters/flake8");

const testName = "flake8";
const linter = Flake8;
const extensions = ["py"];

// Linting without auto-fixing
function getLintParams(dir) {
	const stdoutFile1 = `.${sep}file1.py:5:9: E211 whitespace before '('${EOL}.${sep}file1.py:26:1: E305 expected 2 blank lines after class or function definition, found 1`;
	const stdoutFile2 = `.${sep}file2.py:2:3: E111 indentation is not a multiple of four`;
	return {
		// Expected output of the linting function
		cmdOutput: {
			status: 1,
			stdoutParts: [stdoutFile1, stdoutFile2],
			stdout: `${stdoutFile1}${EOL}${stdoutFile2}`,
		},
		// Expected output of the parsing function
		lintResult: {
			isSuccess: false,
			warning: [],
			error: [
				{
					path: "file1.py",
					firstLine: 5,
					lastLine: 5,
					message: "Whitespace before '(' (E211)",
				},
				{
					path: "file1.py",
					firstLine: 26,
					lastLine: 26,
					message: "Expected 2 blank lines after class or function definition, found 1 (E305)",
				},
				{
					path: "file2.py",
					firstLine: 2,
					lastLine: 2,
					message: "Indentation is not a multiple of four (E111)",
				},
			],
		},
	};
}

// Linting with auto-fixing
const getFixParams = getLintParams; // Does not support auto-fixing -> option has no effect

module.exports = [testName, linter, extensions, getLintParams, getFixParams];
