Skip to content

Provide natively loaded package index project data #187

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

Merged
merged 2 commits into from
Jun 11, 2021
Merged

Provide natively loaded package index project data #187

merged 2 commits into from
Jun 11, 2021

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Jun 10, 2021

Arduino CLI's package index loading function can can be useful in its current capacity as a general check on the validity of the package index as far as Arduino CLI is concerned, used for that purpose by a single dedicated rule (ID002.

However, it can not be used as a data source for other rules because Arduino CLI should attempt to be resilient to bad data when possible, while Arduino Lint needs to detect the very bad data that Arduino CLI might correct.

So the data from the native loading code must be used in all rules, while the value from Arduino CLI's load is solely in whether or not it returned an error.

per1234 added 2 commits June 10, 2021 15:50
Each possible problem with the project is handled by a dedicated rule. One such problem is that the project was not
found. Each rule must be configured so that unrelated problems with the project will not cause them to break or provide
incorrect results. This can result in a lot of redundant boilerplate code. Before running a rule against the package
index data, it is always necessary to check whether the data is available. If not, running the rule is abandoned with a
"NotRun" result. This which results in just such boilerplate, but is likely to be unavoidable without breaking from the
modular architecture of the rules system.

If the package index file itself was not found, then the loading of the data can not be accomplished, and thus a missing
package index should also be cause for abandoning the run of data rules. The check for data can serve as an implicit
check for the existence of the data source, meaning additional rule function boilerplate for file existence check can be
avoided.
Arduino CLI's package index loading function can can be useful in its current capacity as a general check on the validity
of the package index as far as Arduino CLI is concerned, used for that purpose by a single dedicated rule.

However, it can not be used as a data source for other rules because Arduino CLI should attempt to be resilient to bad
data when possible, while Arduino Lint needs to detect the very bad data that Arduino CLI might correct.

So the data from the native loading code must be used in all rules, while the value from Arduino CLI's load is solely in
whether or not it returned an error.
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jun 10, 2021
@per1234 per1234 requested review from silvanocerza and umbynos June 10, 2021 22:59
@codecov-commenter
Copy link

Codecov Report

Merging #187 (447d7cd) into main (53c1162) will increase coverage by 0.00%.
The diff coverage is 87.65%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #187   +/-   ##
=======================================
  Coverage   84.45%   84.45%           
=======================================
  Files          43       43           
  Lines        3017     3082   +65     
=======================================
+ Hits         2548     2603   +55     
- Misses        375      380    +5     
- Partials       94       99    +5     
Flag Coverage Δ
unit 84.45% <87.65%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ternal/rule/ruleconfiguration/ruleconfiguration.go 100.00% <ø> (ø)
internal/rule/schema/testdata/bindata.go 33.01% <ø> (ø)
internal/rule/schema/schemadata/bindata.go 51.65% <80.00%> (+3.02%) ⬆️
internal/project/packageindex/packageindex.go 90.24% <90.90%> (+0.77%) ⬆️
internal/project/projectdata/packageindex.go 100.00% <100.00%> (ø)
internal/rule/rulefunction/library.go 94.79% <100.00%> (ø)
internal/rule/rulefunction/packageindex.go 82.60% <100.00%> (+13.37%) ⬆️
internal/rule/schema/parsevalidationresult.go 93.25% <100.00%> (+0.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 757c8e2...447d7cd. Read the comment docs.

@per1234 per1234 changed the title Provide natively loaded data as package index project data Provide natively loaded package index project data Jun 10, 2021
@per1234 per1234 merged commit 3427584 into arduino:main Jun 11, 2021
@per1234 per1234 deleted the load-package-index branch June 11, 2021 07:10
@per1234 per1234 self-assigned this Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants