Conversation
|
cc @mithro |
|
We should never need a skip like this. If we want to exclude generated or vendor code, we should mark them as generated or vendored (what linguist calls third party) in the
|
eb1db9f to
a563073
Compare
This commit also allows to skip the generated files checks by adding the file to the .gitattributes file Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
a563073 to
e62d888
Compare
Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
|
@mithro I have added |
| continue | ||
|
|
||
| ftype = detect_file_type(fpath) | ||
| ftype = ftypes.get(os.path.relpath(fpath, root_dir), None) |
There was a problem hiding this comment.
Either we should remove the detect_file_type function or do something like;
| ftype = ftypes.get(os.path.relpath(fpath, root_dir), None) | |
| ftype = ftypes.get(os.path.relpath(fpath, root_dir), detect_file_type(fpath)) |
|
|
||
| errors = {} | ||
|
|
||
| json_data = subprocess.check_output("github-linguist --json", shell=True).decode('utf8') |
There was a problem hiding this comment.
The output of github-linguist doesn't seem to actually specify if a file is vendored or generated.
Looking at https://github.com/github/linguist/blob/master/bin/github-linguist#L61-L87
tansell@tansell-glapstation:~/github/SymbiFlow/actions$ github-linguist third_party/make-env/os.mk
os.mk: 95 lines (85 sloc)
type: Text
mime type: text/plain
language: Makefile
appears to be a vendored file
However the generated attribute doesn't seem to be working?
tansell@tansell-glapstation:~/github/SymbiFlow/actions$ git check-attr --all checks/tests/license/test-missing-spdx-generated.v
checks/tests/license/test-missing-spdx-generated.v: linguist-generated: set
tansell@tansell-glapstation:~/github/SymbiFlow/actions$ github-linguist checks/tests/license/test-missing-spdx-generated.v
test-missing-spdx-generated.v: 5 lines (3 sloc)
type: Text
mime type: text/plain
language: Verilog
There was a problem hiding this comment.
I have dove a bit in the linguist code, and, for what I understand, the .gitattributes file is taken into account only when dealing with full repository statistics, therefore it does not have an effect when dealing with single files stats, hence the verilog file is not detected as generated.
Furthermore, when the full-repo statistics are generated, only programming and markup files are taken to report statistics, and data and nil types are left out, as written here.
It turns out that YAML is defined as a data type, and all yaml files are currently excluded by the license check.
I think we can still use linguist to detect the file types, but not to correctly override the generated files.
There was a problem hiding this comment.
@acomodi - I think we probably want to extend linguist to support outputting the information we want. I started looking at that and ran into issues understanding how to use the Ruby rugged module.
There was a problem hiding this comment.
Signed-off-by: Alessandro Comodi acomodi@antmicro.com
Fixes #27