Commit graph

30 commits

Author SHA1 Message Date
Stepan Koltsov
e059100991
Ignore files marked with @generated marker (#1689)
* Ignore files marked with @generated marker

`@generated` marker is used by certain tools to understand that the
file is generated, so it should be treated differently than a file
written by a human:
* these files do not need to be reformatted,
* diffs in these files are less important,
* and linters should not be invoked on these files.

This PR proposes builtin support for `@generated` marker (and
`@not-generated` marker to mark file as not generated when it
contains `@generated` marker, like `README.md`).

I have not found a standard for a generated file marker, but:
* Facebook [uses `@generated` marker](https://tinyurl.com/fb-generated)
* Phabricator tool which was spawned from Facebook internal tool
  [also understands `@generated` marker](https://git.io/JnVHa)
* Cargo inserts `@generated` marker into [generated Cargo.lock files](https://git.io/JnVHP)

Super-linter supports regex includes and excludes, but they are
harder to maintain (each repository needs to be configured) than
patching the tools which generate the files.

My personal story is that I maintain rust-protobuf crate, which
started emitting `@generated` markers [six years ago](https://git.io/JnV5h)
after a request of a Phabricator user.

Test Plan:

Create a test file `test.sh`:

```
echo $a
```

Run:

```
docker run -e RUN_LOCAL=true -v $HOME/tmp/g:/tmp/lint super-linter-test
```

Result is:

```
In /tmp/lint/test.sh line 1:
echo $a
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
     ^-- SC2154: a is referenced but not assigned.
     ^-- SC2086: Double quote to prevent globbing and word splitting.
...
2021-06-22 23:46:16 [ERROR]   ERRORS FOUND in BASH:[1]
```

Now add `@generated` to the file and run again:

```
2021-06-22 23:47:13 [NOTICE]   All file(s) linted successfully with no errors detected
```

Additionally, add `@not-generated` in addition to `@generated`, and
linter error pops up again.

* cleanup

* remove space

* fix non utf return

* fix non utf return

Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2021-06-28 07:59:11 -05:00
Lukas Gravley
4faa6433ab
adding find algorithm (#1640)
* adding find

* add default value
2021-06-08 10:40:59 -05:00
DanEmord
3dc85fc3bc
Allow ansible-lint with git diffs (#1554)
* Allow ansible-lint with git diffs

super-linter checks the path of the file in lib/functions/detectFiles.sh to determine whether the file is an ansible playbook. When VALIDATE_ALL_CODEBASE=true, a list of absolute paths is generated which matches the expected path but when VALIDATE_ALL_CODEBASE=false, a list of relative paths is generated so no files are "detected" as ansible playbooks. This change outputs everything as an absolute path so diffs will also work.

* fix quotes

* Include eval to interpret pipe in cmd substitution

* more quotes

Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
2021-05-12 09:59:31 -05:00
Lukas Gravley
3e0bd7fff4
Eslint for json jsonc and json5 (#1524)
* adding it

* fix typo

* fix tests

* adding back jsonlint

* adding back jsonlint

* fix spacing

* found the typo

* add tests

* adding rules for json

* add to local
2021-05-11 10:54:58 -05:00
Lukas Gravley
5d2ea81f00
Cpp (#1492)
* adding cpp

* adding cpp

* tests

* make test better

* fix test
2021-05-04 13:24:41 -05:00
Marco Ferrari
527c5a3986
Generate a code coverage report (#1353)
* Generate a code coverage report

* make linters happy

* adding action and badge

* no report for me

* Upload the test report

* adding folders

* spaces not tabs

* makefiles love tabs

* spacing is important

* rawr

* Fix makefile

* Add diagnostic info

* Set UID and GID

* Make info

* Add docker images in diagnostic info

* Move info before testing the local action

* Add missing -C to git diff-tree

* Reset ownership

* Add missing quotes

* Sudo

* Attempt to fix ARM test

* Attempt to fix go test

Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
2021-04-22 13:56:18 -05:00
Lukas Gravley
08a586cf3b
adding Python MyPy (#1401)
* adding fun

* fix whitespace

* adding tests

* adding the array

* bug in file name

* fix tap

* makes no sense

* adding the hammer

* adding some extra protbuf
2021-03-24 14:00:23 -05:00
Gabriel Diaz
07a16ed119
Fix to lint other .env.* files (#1336) 2021-03-10 08:38:31 -06:00
Antonio Yang
60e2561b15
Add clippy for rust (#1277)
* Add clippy for Rust

* Update ARM test cases

- fix arm good test case
- update tap report

* Lint github workflows release config
2021-03-08 14:13:04 -06:00
Gabriel Diaz
f58e607c4b
Fix buggy diff cmd (#1314)
* Fix buggy diff cmd

* Fix new line for diff cmd output

Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2021-03-05 11:25:31 -06:00
Kim SeungSu
68c8bf9f11
fix, checkout DEFAULT_BRANCH for diff base (#1308) 2021-03-05 08:57:16 -06:00
Gabriel Diaz
11720172cb
Fix get file diff on pr event (#1305)
* Fix pr event sha

* Improve cmd

* Fix space
2021-03-04 13:51:44 -06:00
Gabriel Diaz
46df94844c
Add debug info for multi status api calls (#1287)
* Add debug info for multi status api calls

* Add test for clean action

* Add more verbose

* Test in action context

* Test use local build as action

* Improve debug for raw file array

* Fix shallow fetch

* Fix error messages on diff cmd

* Changed repeated code to function

* Fix quotes
2021-03-02 08:29:12 -06:00
Antonio Yang
f47b363f71
Add rustfmt for Rust (#1250)
* Add linter for Rust

- add 2015 edition
- add 2018 edition

* Add tap reports

- add tap reports
- fix good test case

* 1 command=lesslayers

Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2021-02-26 08:47:21 -06:00
Gabriel Diaz
71d36c41c2
Add logic to check command output before maping the files (#1259) 2021-02-25 18:15:51 +00:00
Eric Nemchik
389fe11f9b
Use git ls-tree to build file list (#1192)
* Ignore files that are ignored by Git (#1185)

* Ignore files that are ignored by Git

* Add missing continue statement

* Fix linting errors

* Fix linting errors

* like it

* like it

* Add the IGNORE_GITIGNORED_FILES variable

* Fix setting the Ansible directory when running tests

* Fix var export

* Update linter.sh

Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>

* Remove RenameTestFolder

* Update action.yml

* removing the dockignore from our test...

* fixed it

Co-authored-by: Marco Ferrari <ferrari.marco@gmail.com>
Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
2021-02-23 11:51:34 -06:00
Marco Ferrari
b6bbc88e8e
Ignore files that are ignored by Git (#1185)
* Ignore files that are ignored by Git

* Add missing continue statement

* Fix linting errors

* Fix linting errors

* like it

* like it

* Add the IGNORE_GITIGNORED_FILES variable

* Fix setting the Ansible directory when running tests

* Fix var export

* Update linter.sh

Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
2021-02-18 12:15:50 -06:00
Thorbjörn 'Puggan' Sundragon
3abe0fc5e6
Move FILTER_REGEX_INCLUDE and FILTER_REGEX_EXCLUDE test (#1022)
* Move FILTER_REGEX_INCLUDE AND FILTER_REGEX_EXCLUDE before checking filetype

* missing continue, and a lint error

Co-authored-by: Marco Ferrari <ferrari.marco@gmail.com>
2021-02-03 09:52:12 -06:00
Marco Ferrari
ab8780a58f
Install, configure, and run jscpd. Add missing tests (#1032)
Co-authored-by: Gabo <gabo.fdc@gmail.com>
Co-authored-by: Matt Desmond <beardofedu@github.com>
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2021-01-27 20:47:34 +01:00
Gabriel Diaz
88645c0977
Move switch back to code branch (#1139)
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2021-01-12 12:55:02 -06:00
Lukas Gravley
8c3fefc145
fix logic for docker (#1119)
* fix logic

* remove space
2021-01-04 14:25:33 -06:00
Lukas Gravley
193de39afd
Adding support for Prettier (#1118)
* adding it

* fix spaces

* vars were backwards

* remove prettier from function test
2021-01-04 11:07:57 -06:00
Gabriel Diaz
3ce39c07d9
Check OpenAPI yaml files (#1094)
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2020-12-23 18:16:17 -05:00
Marco Ferrari
156024e231
Simplify linter and worker by generalizing ansible-lint (#1035)
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2020-12-04 16:04:09 -06:00
Lukas Gravley
6f1a131b14
fixing logic for file find (#1049)
* fixing logic

* fix warn error

* fix files

* maybe?

* fix test name

* fix test
2020-12-03 16:17:55 -06:00
Marco Ferrari
241f9f2cad
Harden testing (#982) 2020-11-20 09:12:31 -06:00
Lukas Gravley
cf19607c3c
Gherkin (#1011)
* adding gherkin

* adding to array

* fix space

* Update Dockerfile

* adding rules

* adding rules

Co-authored-by: SVN Migrator <someone@somewhere.com>
2020-11-19 09:54:20 -06:00
Barry Pollard
7a907a722c
Ignore more files from linting (#1003)
* Ignore node_modules and env folders

* Exclude media files

* Change env directory to separate dirs

* Remove env files

* Sort in alphabetical order

Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2020-11-18 13:50:07 -06:00
Marco Ferrari
3c1cecb7f8
Exclude __pycache__ and .pytest_cache from file list (#998)
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2020-11-13 09:05:04 -06:00
Lukas Gravley
7943ce1f54
break out: (#990)
* break out:

* fix it

* fix source

* add them exports

* more path

* more path
2020-11-12 11:27:34 -06:00
Renamed from lib/buildFileList.sh (Browse further)