-
Notifications
You must be signed in to change notification settings - Fork 60
Added linters to the project #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BassCoder2808
wants to merge
13
commits into
spdx:main
Choose a base branch
from
BassCoder2808:NewLint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1e2c215
Added linters to the project for all lang
BassCoder2808 d19081f
Made changes to linters as they were failing
BassCoder2808 97e3ba4
Made Changes to the workflow
BassCoder2808 681209a
Changed wrong code
BassCoder2808 34d3031
Modified file code
BassCoder2808 e7a7e03
Changed HTML Hint code
BassCoder2808 c317fa9
New HTMLHint
BassCoder2808 e4de4b9
Fixed pyint
BassCoder2808 0f3a8fa
Change pylint
BassCoder2808 5ada075
changes in pylint
BassCoder2808 e9fbc70
removed invalid syntax
BassCoder2808 4170124
For demo workflow
BassCoder2808 79a5278
Changed demo files
BassCoder2808 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| module.exports = { | ||
| env: { | ||
| browser: true, | ||
| es2021: true, | ||
| }, | ||
| extends: ["airbnb-base"], | ||
| parserOptions: { | ||
| ecmaVersion: 12, | ||
| sourceType: "module", | ||
| }, | ||
| rules: { | ||
| "max-len": ["warn", { code: 120 }], // Limit lines to 120 characters | ||
| indent: ["warn", 2], // Use 2 spaces for indentation | ||
| "no-tabs": "warn", // Disallow tabs | ||
| "linebreak-style": ["warn", "unix"], // Enforce Unix line endings | ||
| "no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], // Ignore unused function arguments starting with underscore (_) | ||
| "no-console": "off", // Allow console statements | ||
| "comma-dangle": ["warn", "never"], // Disallow trailing commas in arrays and objects | ||
| "arrow-parens": ["warn", "as-needed"], // Require parentheses around arrow function parameters only when needed | ||
| "object-curly-spacing": ["warn", "always"], // Require spaces inside curly braces of objects | ||
| quotes: ["warn", "double", { avoidEscape: true }], | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| name: Linting | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "**.js" | ||
| - "**.html" | ||
| - "**.css" | ||
| - "**.py" | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "**.js" | ||
| - "**.html" | ||
| - "**.css" | ||
| - "**.py" | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v2 | ||
| with: | ||
| node-version: 14 | ||
|
|
||
| - name: Checkout code | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Get modified files | ||
| id: get_modified_files | ||
| run: echo "::set-output name=files::$(git diff --name-only HEAD^)" | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci # For JavaScript linting (replace with your package manager command) | ||
|
|
||
| - name: Run ESLint | ||
| run: npx eslint ${{ steps.get_modified_files.outputs.files }} --ext .js --fix | ||
|
|
||
| - name: Run HTMLHint | ||
| run: | | ||
| for file in ${{ steps.get_modified_files.outputs.files }}; do | ||
| htmlhint --rules .htmlhintrc "$file" || true | ||
| done | ||
|
|
||
| - name: Run Stylelint | ||
| run: npx stylelint ${{ steps.get_modified_files.outputs.files }} --quiet --fix | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: 3.9 | ||
|
|
||
| - name: Install Python dependencies | ||
| run: pip install -r requirements.txt # For Python linting (replace with your command) | ||
|
|
||
| - name: Run Pylint | ||
| run: | | ||
| for file in ${{ steps.get_modified_files.outputs.files }}; do | ||
| pylint --disable=all --enable=warning --rcfile=.pylintrc "$file" || true | ||
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,3 +132,5 @@ data/certbot/ | |
|
|
||
| container_logs | ||
|
|
||
| # node modules | ||
| node_modules/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "tagname-lowercase": "warning", // Enforce lowercase tag names | ||
| "attr-lowercase": "warning", // Enforce lowercase attribute names | ||
| "attr-value-double-quotes": "warning", // Require double quotes for attribute values | ||
| "attr-value-not-empty": "warning", // Disallow empty attribute values | ||
| "doctype-first": "warning", // Require the doctype declaration to be the first line | ||
| "tag-pair": "warning", // Require opening and closing tags to be paired | ||
| "tag-self-close": "warning", // Allow self-closing tags | ||
| "spec-char-escape": "warning", // Require escaping special characters | ||
| "id-unique": "warning", // Require unique IDs | ||
| "src-not-empty": "warning", // Disallow empty src attribute values | ||
| "alt-require": "warning", // Require alt attributes for images | ||
| "space-tab-mixed-disabled": "space", // Disallow mixed spaces and tabs, enforce spaces | ||
| "id-class-value": "dash", // Enforce dashes for ID and class names | ||
| "doctype-html5": "warning", // Enforce HTML5 doctype | ||
| "attr-no-duplication": "warning", // Disallow duplicate attributes | ||
| "title-require": "warning", // Require title tag in head section | ||
| "head-req-title": "warning", // Require title tag to be non-empty | ||
| "tag-req-attr": "warning", // Require attributes for specific tags | ||
| "attr-unsafe-chars": "warning" // Disallow unsafe characters in attribute values | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| [MESSAGES CONTROL] | ||
| disable = C0114,C0115,C0116 | ||
|
|
||
| [FORMAT] | ||
| max-line-length = 120 | ||
|
|
||
| [TYPECHECK] | ||
| ignored-modules = setuptools | ||
|
|
||
| [DESIGN] | ||
| max-args = 6 | ||
| max-locals = 15 | ||
| max-branches = 12 | ||
| max-statements = 50 | ||
| max-parents = 7 | ||
| max-attributes = 7 | ||
|
|
||
| [CLASSES] | ||
| defining-attr-methods = **init**,**new**,setUp | ||
| valid-metaclass-classmethod-first-arg = True | ||
|
|
||
| [IMPORTS] | ||
| ignore = cv2,numpy | ||
|
|
||
| [SIMILARITIES] | ||
| min-similarity-lines = 10 | ||
| ignore-comments = yes | ||
| ignore-docstrings = yes | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "extends": "stylelint-config-recommended", | ||
| "rules": { | ||
| "indentation": 2, // Use 2 spaces for indentation | ||
| "block-no-empty": "warning", // Disallow empty blocks | ||
| "color-hex-length": "long", // Enforce long hex color notation (#RRGGBB) | ||
| "color-no-invalid-hex": "warning", // Disallow invalid hex colors | ||
| "declaration-block-trailing-semicolon": "always", // Require a trailing semicolon in declaration blocks | ||
| "declaration-colon-space-after": "always", // Require a space after the colon in declarations | ||
| "declaration-colon-space-before": "never", // Disallow a space before the colon in declarations | ||
| "declaration-block-single-line-max-declarations": 1, // Allow only one declaration per line in single-line declaration blocks | ||
| "property-no-unknown": "warning", // Disallow unknown properties | ||
| "selector-pseudo-element-no-unknown": "warning", // Disallow unknown pseudo-element selectors | ||
| "selector-pseudo-class-no-unknown": "warning", // Disallow unknown pseudo-class selectors | ||
| "selector-type-no-unknown": "warning", // Disallow unknown element type selectors | ||
| "string-quotes": "double", // Enforce double quotes for strings | ||
| "value-keyword-case": "lower" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where's the change when these linters are applied to all the files in the project? I think I will delay merging this just to have less conflicts with other open PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had just made the files and ran them only on few files and not all. Should I run them on all the files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, run all the test. We need to confirm everything works fine after your changes land.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BassCoder2808 Did you run the tests for this after linting? Also make sure the app works fine and there are no code leakages.