Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .eslintrc.js
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 }],
},
};
65 changes: 65 additions & 0 deletions .github/workflows/lint.yaml
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@ data/certbot/

container_logs

# node modules
node_modules/
21 changes: 21 additions & 0 deletions .htmlhintrc
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
}
28 changes: 28 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[MESSAGES CONTROL]
Copy link
Collaborator

@rtgdk rtgdk Aug 24, 2023

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.

Copy link
Contributor Author

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?

Copy link
Collaborator

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.

Copy link
Collaborator

@rtgdk rtgdk Oct 3, 2023

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.

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
19 changes: 19 additions & 0 deletions .stylelintrc
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"
}
}
Loading