-
Notifications
You must be signed in to change notification settings - Fork 379
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
Nomenclature fixes and some TODO cleanup #856
Conversation
dc446db
to
9fc6237
Compare
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.
Nice work! Most of my comments related to possible additional cleanups. Only a few questions for these changes.
api/report_server.thrift
Outdated
@@ -21,58 +21,55 @@ const string API_VERSION = '6.0' | |||
const i64 MAX_QUERY_SIZE = 500 | |||
//================================================= | |||
|
|||
//----------------------------------------------------------------------------- | |||
struct RunData{ | |||
struct RunData { | |||
1: i64 runId, // unique id of the run |
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.
Maybe we could adopt the convention of having full sentences in comments to comply with the rest of the codebase as the part of this revamp?
api/report_server.thrift
Outdated
9: shared.Severity severity // checker severity | ||
10: ReviewData review // bug review status informations. | ||
struct ReportData { | ||
1: string checkerId, // the qualified id of the checker that reported this |
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.
Maybe this should be renamed as this is the name of the check.
api/report_server.thrift
Outdated
7: i64 line, // line number or the reports main section (not part of the path) | ||
8: i64 column, // column number of the report main section (not part of the path) | ||
9: shared.Severity severity // checker severity | ||
10: ReviewData review // bug review status informations. |
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 would prefer to call this reviewStatus
.
api/report_server.thrift
Outdated
struct ReportData { | ||
1: string checkerId, // the qualified id of the checker that reported this | ||
2: string bugHash, // This is unique id of the concrete report. | ||
3: string checkedFile, // this is a filepath |
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.
In case this is the main file
which was given for the analyzer, we should use the same nomenclature.
@@ -93,7 +90,7 @@ typedef list<ReportFilter> ReportFilterList | |||
* Members of this struct are interpreted in "OR" relation with each other. |
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 think this comment is very confusing. Both sentences referring to the members of the struct. Is this correct?
Why do we need the v1
? Can we remove that now?
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.
As a side note, I am not sure this has the same expressivity as the old version.
E.g. how do you represent:
(filepath == A AND checkerName == B) OR (severity == C and reviewStatus == D)
Note that the old format was basically a disjunctive normal form, so we could be sure that every predicate could be translated to that.
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.
v1 can only be removed if the command-line client is upgraded to use the same, new, "v2" filtering semantics.
(filepath == A AND checkerName == B) OR (severity == C and reviewStatus == D)
This kind of filter was not explicable by any of the clients in the v1 version either, even if the API -- if directly called -- seemed to had supported that.
@gyorb, @csordasmarton rewrote the filtering system.
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 old ReportFilter
will be removed.
required=False, | ||
default=argparse.SUPPRESS, |
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.
Why do we need this change?
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.
To not have (default: False)
printed for the help message in every argument if the argument is already a boolean, and its help already makes it apparent that "it does something if given, otherwise it does not do something ".
) | ||
# Some arguments don't have default values. | ||
# We can't set these keys to None because it would result in an error | ||
# after the call. | ||
args_to_update = ['skipfile', | ||
'analyzers', | ||
'add_compiler_defaults', |
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.
Why can't this have a default value?
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.
As above. Boolean options' help messages usually look better if default: False
is not given. The code behaves in a way that if it is not passed, it is considered False
.
@@ -322,14 +318,14 @@ def __update_if_key_exists(source, target, key): | |||
output_path=workspace, | |||
output_format='plist', | |||
clean=True, | |||
jobs=args.jobs, | |||
add_compiler_defaults=args.add_compiler_defaults | |||
jobs=args.jobs | |||
) | |||
# Some arguments don't have default values. | |||
# We can't set these keys to None because it would result in an error | |||
# after the call. | |||
args_to_update = ['skipfile', |
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.
Looks like this list is replicated. In the future, it might be better to refactor it in a way that this list is created together with the arg parsers.
api/report_server.thrift
Outdated
1: i64 runId, // unique id of the run | ||
2: string runDate, // date of the run | ||
3: string name, // human readable name of the run | ||
4: i64 duration, // duration of the run; -1 if not finished | ||
5: i64 resultCount, // number of results in the run | ||
6: string runCmd, // the used check command | ||
7: optional bool can_delete // true if codeCheckerDBAccess::removeRunResults() | ||
7: optional bool canDelete, // true if codeCheckerDBAccess::removeRunResults() |
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.
Do we still need the canDelete
? I'm not sure we use it in the database with the new schema.
@@ -93,7 +90,7 @@ typedef list<ReportFilter> ReportFilterList | |||
* Members of this struct are interpreted in "OR" relation with each other. |
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 old ReportFilter
will be removed.
9fc6237
to
71939ac
Compare
If everything is fine, I'll squash these commits! Don't merge beforehand. |
- The 'plist' command which was undocumented for a few releases now has been removed permanently. - Argument list and help of many commands have been made better - The "old-style" 'checkers' command is dropped in favour of the new one introduced back in 5.8. - Most 'cmd' subcommands take run-name as a positional argument, rather than "--name RUN_NAME". - Thrift files have been reformatted to a new scheme of comments and naming.
4d0de47
to
f2003cc
Compare
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.
LGTM!
For now, I've added many comments so we can individually see the changes. Of course this can be squashed later.