{"id":21678426,"url":"https://github.com/petervanderdoes/gulp-flake8","last_synced_at":"2025-04-12T05:36:15.362Z","repository":{"id":57135923,"uuid":"66745595","full_name":"petervanderdoes/gulp-flake8","owner":"petervanderdoes","description":"Gulp plugin to run flake8","archived":false,"fork":false,"pushed_at":"2019-05-01T14:55:23.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-26T01:01:49.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petervanderdoes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-28T02:33:46.000Z","updated_at":"2017-08-29T19:07:57.000Z","dependencies_parsed_at":"2022-09-04T09:00:32.958Z","dependency_job_id":null,"html_url":"https://github.com/petervanderdoes/gulp-flake8","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petervanderdoes%2Fgulp-flake8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petervanderdoes%2Fgulp-flake8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petervanderdoes%2Fgulp-flake8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petervanderdoes%2Fgulp-flake8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petervanderdoes","download_url":"https://codeload.github.com/petervanderdoes/gulp-flake8/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248524520,"owners_count":21118612,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T14:34:04.750Z","updated_at":"2025-04-12T05:36:15.313Z","avatar_url":"https://github.com/petervanderdoes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[license]: /LICENSE\n[npm-image]: https://img.shields.io/npm/v/@petervanderdoes/gulp-flake8.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@petervanderdoes/gulp-flake8\n[downloads-image]: https://img.shields.io/npm/dm/@petervanderdoes/gulp-flake8.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/@petervanderdoes/gulp-flake8\n[semi-image]: https://img.shields.io/badge/code%20style-strict-brightgreen.svg?style=flat-square\n[semi-url]: https://github.com/Flet/semistandard\n[license-image]: https://img.shields.io/github/license/petervanderdoes/gulp-flake8.svg?style=flat-square\n[license-url]: /LICENSE\n[dependencies-image]: https://david-dm.org/petervanderdoes/gulp-flake8.svg?style=flat-square\n[dependencies-url]: https://david-dm.org/petervanderdoes/gulp-flake8\n[dev-dependencies-image]: https://david-dm.org/petervanderdoes/gulp-flake8/dev-status.svg?style=flat-square\n[dev-dependencies-url]: https://david-dm.org/petervanderdoes/gulp-flake8#info=devDependencies\n\n# gulp-flake8\n\n[![npm][npm-image]][npm-url]\n[![downloads][downloads-image]][downloads-url]\n[![js-semistandard-style][semi-image]][semi-url]\n[![license][license-image]][license-url]\n[![dependencies][dependencies-image]][dependencies-url]\n[![dev-dependencies][dev-dependencies-image]][dev-dependencies-url]\n\n[Flake8](https://gitlab.com/pycqa/flake8) plugin for [gulp](http://gulpjs.com).\n\n[Flake8](https://gitlab.com/pycqa/flake8) is a python tool that glues together\npep8, pyflakes, mccabe, and third-party plugins to check the style and\nquality of some python code.\nThis plugin wraps the flake8 binary for gulp and provides fancy and original reporters.\n\n\n## Install\n\n    npm install @petervanderdoes/gulp-flake8 --save-dev\n\nThis plugin requires [flake8](http://flake8.pycqa.org/en/latest/#installation)\nto be installed.\n\nFrom a terminal:\n\n```sh\npython -m pip install flake8\n```\n\n## Usage\n\n```javascript\ngulp.task('lint-python', function () {\n  return gulp.src(['**/*py',\n    '!**/build/**',\n    '!**/dist/**',\n    '!**/node_modules/**'])\n    .pipe(flake8())\n    .pipe(flake8.reporter())\n    .pipe(flake8.failOnError());\n});\n```\n### Important\n\nYou need to include/exclude files and directories through the ``gulp.src``\noption. Due to the way this plugin and flake8 works, it won't respect the\nexclude option in the flake8 configuration.\n\n## API\n\n### flake8(configFile)\n\n#### configFile\nType: `String`\n\nYou can pass the path to your flake8 config file directly to the plugin,\nthough if your config file uses the standard file name and location\nthen flake8 will find it by default.\n\n```javascript\ngulp.src('**/*py')\n  .pipe(flake8('.flake8'))\n```\n\n### flake8(options)\n\n#### options\nType: `Object`\n\nFor example:\n\n```javascript\nscsslint({\n  config: '.flake8',\n  bin: 'flake8',\n  args: ['--ignore=W503'] // see caveat below\n})\n```\n\n##### options property: `config`\nType: `String`\n\nPath to your flake8 config file.  Default is `undefined`.\n\n##### options property: `bin`\nType: `String`\n\nThe flake8 call signature.  Default is `flake8`.\n\n##### options property: `args`\nType: `Array`\n\nAn array of additional arguments supported by `flake8`.  See\n`flake8 --help` for options.\n\nFor example:\n```javascript\nargs: ['--ignore=W503']\n```\n\n**N.B.**: Flake8 works best using a configuration file. This is just an \npersonal observation.\n\n### flake8.reporter(format)\n\n##### format\nType: `String`\n\nThe format of the report. The plugin comes with two build-in options:\n- original\n- fancy\n\nDefault is `original`\n\n###### original\nThe same format like `flake8`\n\nExample:\n```javascript\nstuff\n  .pipe(flake8())\n  .pipe(flake8.reporter())\n```\nExample Output:\n\n```\n./__main__.py 17:1: F401 'os' imported but unused\n./sample/config/apps.py 25:9: F401 'sample.config.signals' imported but unused\n./sample/config/urls.py 26:4: E121 continuation line under-indented for hanging indent\n./sample/config/urls.py 34:4: E121 continuation line under-indented for hanging indent\n./sample/config/urls.py 44:4: E121 continuation line under-indented for hanging indent\n./sample/core/apps.py 25:9: F401 'sample.core.signals' imported but unused\n```\n\n###### fancy\nA colored output and if a file has multiple errors, the filename is only \ndisplayed on the first error.\n\nExample:\n```javascript\nstuff\n  .pipe(flake8())\n  .pipe(flake8.reporter('fancy'))\n```\nExample output:\n\n```\n__main__.py 17:1 F401 'os' imported but unused\nsample/config/apps.py 25:9 F401 'sample.config.signals' imported but unused\nsample/config/urls.py 26:4 E121 continuation line under-indented for hanging indent\n                      34:4 E121 continuation line under-indented for hanging indent\n                      44:4 E121 continuation line under-indented for hanging indent\nsample/core/apps.py 25:9 F401 'sample.core.signals' imported but unused\n```\n\n### flake8.failOnError()\nStop a task/stream if a ``flake8`` error has been reported for any file.\n\n```javascript\ngulp.task('lint-python', function () {\n  return gulp.src('**/*py')\n    .pipe(flake8())\n    .pipe(flake8.failOnError());\n});\n```\n\n## Result\nType: ``Object``\n\nThe following properties are set to the result object:\n\n```javascript\n  result.flake8.success = true; // or false\n  result.flake8.errorCount = 0; // number of errors returned by Flake8\n  result.flake8.errorList = []; // Flake8 errors\n```\n\nThe objects in `errorList` all have the following properties\n\n```javascript\nresult.flake8.errorList = [{\n  'filename': 'full path of the filename',\n  'row': 10,\n  'column': 4,\n  'reason': 'a description of the error'\n}]\n```\n\n## Custom Reporters\n\nCustom reporter functions can be passed as ``flake8.reporter(reporterFunc)``.\nThe reporter function will be called for each linted file that includes\nan error or warning and will be passed the ``result`` object as described above.\n\n```javascript\nvar flake8 = require('@petervanderdoes/gulp-flake8');\nvar gulp = require('gulp');\nvar gulpUtil = require('gulp-util');\n\nvar myReporter = function(file) {\n  gulpUtil.log(result.flake8.errorCount + ' errors');\n};\n\ngulp.task('lint', function() {\n  return gulp.src('*.py')\n    .pipe(flake8())\n    .pipe(flake8.reporter(myReporter));\n});\n```\n\nSee `src/reports.js` for more detailed examples.\n\n## \nThis plugin was inspired by the following gulp plugins:\n- [gulp-scsslint](https://github.com/noahmiller/gulp-scsslint)\n- [gulp-eslint](https://github.com/adametry/gulp-eslint)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetervanderdoes%2Fgulp-flake8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetervanderdoes%2Fgulp-flake8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetervanderdoes%2Fgulp-flake8/lists"}