-
Notifications
You must be signed in to change notification settings - Fork 6
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
license check: add license check skip id #28
Open
acomodi
wants to merge
2
commits into
f4pga:main
Choose a base branch
from
antmicro:allow-skipping-license-check
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.
+46
−2
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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,7 @@ | ||
# Linguist - vendored override | ||
|
||
third_party/* linguist-vendored | ||
|
||
# Linguist - generated override | ||
|
||
checks/tests/license/test-missing-spdx-generated.v linguist-generated |
This file contains 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
This file contains 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 | ||||
---|---|---|---|---|---|---|
|
@@ -17,6 +17,8 @@ | |||||
import re | ||||||
import sys | ||||||
import tempfile | ||||||
import subprocess | ||||||
import json | ||||||
|
||||||
|
||||||
__path__ = pathlib.Path(__file__).resolve().parent | ||||||
|
@@ -417,6 +419,15 @@ def main(args): | |||||
logging.debug('Starting search in: %s', root_dir) | ||||||
|
||||||
errors = {} | ||||||
|
||||||
json_data = subprocess.check_output("github-linguist --json", shell=True).decode('utf8') | ||||||
files_data = json.loads(json_data) | ||||||
|
||||||
ftypes = {} | ||||||
for ftype, fpaths in files_data.items(): | ||||||
for fpath in fpaths: | ||||||
ftypes[fpath] = ftype | ||||||
|
||||||
for root, dirs, files in os.walk(root_dir): | ||||||
rpath = pathlib.Path(root).resolve() | ||||||
fdebug(rpath, 'Searching') | ||||||
|
@@ -463,9 +474,9 @@ def main(args): | |||||
fwarn(fpath, 'Skipping nonfile') | ||||||
continue | ||||||
|
||||||
ftype = detect_file_type(fpath) | ||||||
ftype = ftypes.get(os.path.relpath(fpath, root_dir), None) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either we should remove the
Suggested change
|
||||||
if ftype is None: | ||||||
finfo(fpath, 'Skipping unknown file type') | ||||||
finfo(fpath, 'Skipping generated or unknown file') | ||||||
continue | ||||||
|
||||||
ferrors = [] | ||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
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.
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
However the generated attribute doesn't seem to be working?
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 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
andmarkup
files are taken to report statistics, anddata
andnil
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github-linguist/linguist#5382