Skip to content
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

Default metric is preselected #1532

Closed
Gaugi28 opened this issue Dec 1, 2020 · 8 comments · Fixed by #2907
Closed

Default metric is preselected #1532

Gaugi28 opened this issue Dec 1, 2020 · 8 comments · Fixed by #2907
Assignees
Labels
difficulty:low Solving this is likely not that difficult feature Feature requests good first issue pr-analysis Issues that touch the analysis pr(oject). pr-visualization Issues that touch the visualization pr(oject) which means web and desktop features. priority:high Set by PO

Comments

@Gaugi28
Copy link

Gaugi28 commented Dec 1, 2020

Feature request

Description

As user who don’t know the metrics and their meaning, I want a default metric which fits to the file so that I don’t have to select the right metric by myself.

Acceptance criteria

  • if a user loads his/her data the right metric is pre-selected.

Open questions

  • How do the system know which metric is the right/default one?
@BridgeAR
Copy link
Member

BridgeAR commented Dec 1, 2020

@ce-bo and me discussed this a few times recently and we thought about implementing a heuristic for known metrics based upon frequently used metrics in audits. We also thought about using machine learning. To do so we might need to ask users to transfer some statistics anonymously about their used metrics, the map size and a few more things.

@BridgeAR BridgeAR added feature Feature requests pr-visualization Issues that touch the visualization pr(oject) which means web and desktop features. priority:high Set by PO labels Dec 1, 2020
@Shivan-997 Shivan-997 self-assigned this Jul 27, 2021
@BridgeAR

This comment was marked as outdated.

@Shivan-997 Shivan-997 removed their assignment Aug 9, 2021
@BridgeAR BridgeAR added difficulty:low Solving this is likely not that difficult good first issue labels Dec 6, 2021
@BridgeAR BridgeAR added this to the Good first issues milestone Dec 16, 2021
@ce-bo ce-bo added the pr-analysis Issues that touch the analysis pr(oject). label Mar 11, 2022
@BridgeAR
Copy link
Member

I updated the requirements to simplify the issue:

  1. Check our parsers/importers what metrics they generate and try to chose a logical frequently used combination that seems useful to most people.

  2. Create a default mode in the frontend for cc.json files. This may be done by using the well defined combinations already known from our parsers/importers and to check if any of those apply (as full metric combination). If neither applies, use the first entry in the metric list.

@ce-bo
Copy link
Collaborator

ce-bo commented Jun 8, 2022

Example:

Known combination 1:
Size / Complexity / Complexity

Category Size: rloc, loc, number_of_statements, etc.
Categroy Complexity: mcc, complexity, sonar_cognitive_complexity, etc.

@IhsenBouallegue IhsenBouallegue self-assigned this Jun 15, 2022
@jannikr jannikr self-assigned this Jun 21, 2022
jannikr added a commit that referenced this issue Jun 21, 2022
IhsenBouallegue added a commit that referenced this issue Jun 22, 2022
jannikr added a commit that referenced this issue Jun 29, 2022
… be specified and suitable metrics are automatically selected #1532
jannikr added a commit that referenced this issue Jun 29, 2022
jannikr added a commit that referenced this issue Jul 5, 2022
jannikr added a commit that referenced this issue Jul 5, 2022
jannikr added a commit that referenced this issue Jul 6, 2022
* Refactor scenarioHelper.ts for automated selection of metric templates / scenarios if applicable #1532

* Refactor scenarioHelper.spec.ts in order to test new functionality #1532

* adjust tests
#1532

* adjust resetChosenMetrics.effect.spec.ts
#1532

* Update README.md

* Update 2022-06-22-v1_99_1.md

* Move getMatchingMetric to metricHelper.ts due to SOC #1532

* Change functionality in metricHelper.ts so that metric categories can be specified and suitable metrics are automatically selected #1532

* Adjust tests #1532

* Update tests for new matching function in metricHelper.spec.ts #1532

* Add minor code improvements #1532

Co-authored-by: jannikolai.rueckert <jan.nr@live.de>
Co-authored-by: Jan N. Rückert <31436472+jannikr@users.noreply.github.com>
@jannikr
Copy link
Contributor

jannikr commented Jul 6, 2022

Basic functionality was implemented with PR #2862. In the further process, the list of metrics will be extended. To evaluate the metrics, here is an overview (not complete).

Metric Category Relevance Done
branch_coverage
bug
classes size not relevant
code_smell
cognitive_complexity complexity 2
comment_lines
commented_out_code_blocks
functions size 6
max_nesting_level complexity 3
line_coverage
loc size 2
mcc complexity 1
rloc size 1
security_hotspots
sonar_blocker_violations
sonar_bugs
sonar_classes size not relevant
sonar_code_smells
sonar_cognitive_complexity complexity 2
sonar_comment_lines_density
sonar_conditions_to_cover
sonar_confirmed_issues
sonar_critical_violations
sonar_duplicated_blocks
sonar_duplicated_files
sonar_duplicated_lines
sonar_duplicated_files_density
sonar_false_positive_issues
sonar_file_complexity
sonar_files
sonar_generated_ncloc
sonar_info_violations
sonar_issue_other
sonar_lines_to_cover
sonar_major_violations
sonar_minor_violations
sonar_open_issues
sonar_public_documented_api_density
sonar_public_undocumented_api
sonar_reopened_issues
sonar_security_hotspots
sonar_security_hotspots_reviewed_status
sonar_security_hotspots_to_review_status
sonar_skipped_tests
sonar_sqale_debt_ratio
sonar_test_errors
sonar_test_failures
sonar_test_success_density
sonar_uncovered_conditions
sonar_uncovered_lines
sonar_violations
sonar_vulnerabilities
sonar_wont_fix_issues
statements size 5
unary
vulnerability

Git Log Parser:

Metric Category Relevance Done
age_in_weeks
number_of_commits
highly_coupled_files
median_coupled_files
number_of_renames
weeks_with_commits
number_of_authors
code_churn
temporal_coupling (only edge metric)

Tokei Importer:

Metric Category Relevance Done
lines size 4
lines_of_code size 3
lines_of_comments
blank_lines

SVN:

Metric Category Relevance Done
age_in_weeks
number_of_commits
highly_coupled_files
median_coupled_files
number_of_renames
weeks_with_commits
number_of_authors
code_churn

Raw Text:

Metric Category Relevance Done
indentation_level complexity 4

@ce-bo
Copy link
Collaborator

ce-bo commented Jul 19, 2022

Hi @jannikr, thank you very much for creating this list of metrics.
I edited the list in your comment and mapped the metrics to size and complexity category.
The Relevance means the order in which we should choose a metric as a default. So cognitive_complexity and sonar_cognitive_complexity have the same order because I think they are synonyms. And I think we only calculate/import sonar_cognitive_complexity. I've never seen the metric cognitive_complexity in our parsers.

Would you please extent the lists in the code?

@MW-Friedrich MW-Friedrich self-assigned this Jul 25, 2022
MW-Friedrich added a commit that referenced this issue Jul 25, 2022
@MW-Friedrich MW-Friedrich linked a pull request Jul 25, 2022 that will close this issue
MW-Friedrich added a commit that referenced this issue Jul 25, 2022
Add an entry to the changelog
Continuation of #1532
@MW-Friedrich MW-Friedrich linked a pull request Jul 25, 2022 that will close this issue
MW-Friedrich added a commit that referenced this issue Jul 25, 2022
@charlotteKehm charlotteKehm self-assigned this Jul 25, 2022
@charlotteKehm
Copy link
Contributor

@ce-bo In metric-gardener exists the metric "real_lines_of_code"? How shall we handle this? In my opinion it is more relevant than "lines_of_code.

@ce-bo
Copy link
Collaborator

ce-bo commented Jul 25, 2022

Yes, thats correct. The corresponding acronym is "rloc" and "rloc" has highest priority.

charlotteKehm pushed a commit that referenced this issue Jul 25, 2022
* Add more metrics for the metric preselection
Add an entry to the changelog
Continuation of #1532

* update the changelog
#1532
knoffi added a commit that referenced this issue Jul 27, 2022
* Improve delta generator spec #2708
[Less symmetry in expected result when counting added+deleted files]

* Improve nodePath spec #2708
[check english grammar for plural/singular edge cases]

* Fix grammar in file count display #2708
[edge case of folder with 0 files is now displayed with correct grammar]

* Add mocked display of changed files #2708

* Fix information display about changed files #2708
[Text shows correctly that a file changed if and only a metric changed]

* Add file comparing in delta generator #2708

* Add metricsChanged by delta generator #2708

* Add display of changed files in html from store #2708

* Fix fileCount selector spec #2708

* Add collecting of metric changes from children #2708

* Refactor FileCount property #2708
[ .metricsChanged to .changed ]

* Fix snapshots for delta generator spec #2708

* Fix logic of delta generator #2708
[For-loop instead of lambda-functions for perfomance in delta generator]

* Document changelog #2708

* Refactor deltaGenerator internally #2708
[Using set instead of array to improve performance]

* Fix file-changed-logic in deltaGenerator #2708
[0 should equal undefined when comparing attributes]

* Change google link to https #2708

* Adjust test mocks and snapshots #2708
[Snapshots use https and mocks have correct propery order]

* Refactor test mock objects #2708
[Reduce duplicated lines marked by sonarqube]

* Refactor mock objects for unit tests #2708
[Extract fileMeta proeprty to reduce code duplication]

* Refactor test mock objects #2707
[Extracted default file and default fileMap]

* Refactor mock files in deltaGenerator spec #2708
[Reduce code duplication for sonar qube]

* Try out comment to disable sonar in line #2708

* fix SonarQube not excluding dataMocks.ts
#1532

Co-authored-by: MW-Friedrich <108457762+MW-Friedrich@users.noreply.github.com>
Co-authored-by: Jan N. Rückert <31436472+jannikr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty:low Solving this is likely not that difficult feature Feature requests good first issue pr-analysis Issues that touch the analysis pr(oject). pr-visualization Issues that touch the visualization pr(oject) which means web and desktop features. priority:high Set by PO
Projects
None yet
8 participants