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

Tagcounters.json no longer being picked up for custom reporting? #286

Closed
marc-patterson opened this issue Sep 15, 2020 · 10 comments
Closed
Labels
bug Something isn't working

Comments

@marc-patterson
Copy link

Description
Following the documentation here, I wanted to see detail of Classes and Functions in the reports, so I created this tagcounters.json file in the preferences directory:

[
    {
      "tag": "Metric.Code.Class.Defined",
      "displayName": "Classes",
      "includeAsMatch": true
    },
    {
      "tag": "Metric.Code.Function.Defined",
      "displayName": "Functions",
      "includeAsMatch": true
    },
    {
      "tag": "Metric.Code.Exception.Caught",
      "displayName": "Exceptions",
      "includeAsMatch": true
    },
    {
      "tag": "Metric.Code.HTMLForm.Defined",
      "displayName": "Forms",
      "includeAsMatch": true
    },
    {
      "tag": "Dependency.SourceInclude",
      "displayName": "Dependencies",
      "includeAsMatch": false
    },
    {
      "tag": "Miscellaneous.CodeHygiene.Comment.Todo",
      "displayName": "Comments",
      "includeAsMatch": false
    },
    {
      "tag": "Miscellaneous.CodeHygiene.Comment.Fix",
      "displayName": "Fix-comments",
      "includeAsMatch": true
    },
    {
      "tag": "Miscellaneous.CodeHygiene.Comment.Suspicious",
      "displayName": "Suspicious-comments",
      "includeAsMatch": true
    },
    {
      "tag": "Metric.Code.Logging.Call",
      "displayName": "Logging Calls",
      "includeAsMatch": false
    },
    {
      "tag": "Metric.Code.URL",
      "displayName": "URL's",
      "includeAsMatch": false
    }
  ]

and then added this to tagreportgroups.json:

      {
        "title": "Code Metrics",
        "dataRef": "CodeMetrics",
        "patterns": [
          {
            "searchPattern": "Metric.Code.Logging.Call",
            "displayName": "Code Logging",
            "detectedIcon": "fab fa-dev"
          },
          {
            "searchPattern": "Metric.Code.Class.Defined",
            "displayName": "Class Defined",
            "detectedIcon": "fab fa-dev"
          },
          {
            "searchPattern": "Metric.Code.Exception.Caught",
            "displayName": "Exception Caught",
            "detectedIcon": "fab fa-dev"
          },
          {
            "searchPattern": "Metric.Code.URL",
            "displayName": "Code URL",
            "detectedIcon": "fab fa-dev"
          },
          {
            "searchPattern": "Metric.Code.Function.Defined",
            "displayName": "Function Defined",
            "detectedIcon": "fab fa-dev"
          }                                       
        ]
      } 

Running an analysis results in the custom Code Metrics section being added to the report, but no results for Class Defined or Function Defined are shown.

Furthermore on the Summary - Tag Counters screen, it displays:

  • Metric.Code.Function.Defined: Count: 119 Include as Match: false
  • Metric.Code.Class.Defined - Count: 18 Include as Match: false

So it appears to be picking up the customisations in tagreportgroups.json, but not in tagcounters.json.

Screenshots
Screenshot 2020-09-15 at 17 06 17
Screenshot 2020-09-15 at 17 05 56

Desktop

  • macOS Catalina
  • Google Chrome v85
  • Application Inspector v1.2.63
@marc-patterson marc-patterson added the bug Something isn't working label Sep 15, 2020
@guyacosta
Copy link
Contributor

Ah yes there is code to exclude "Metric" tags from the report which are deemed non-essential i.e. the purpose of the primary report on the HTML UI features page is...features not metrics. They will continue to appear in the Summary Tag Counters page. Any non-metric tags and associated rules including custom ones will appear in the features section as designed. I will update the wiki for additional clarity about this. Thanks for asking.

@guyacosta guyacosta added working as designed and removed bug Something isn't working labels Sep 16, 2020
@guyacosta
Copy link
Contributor

Updated page to clarify.

@gfs
Copy link
Contributor

gfs commented Sep 16, 2020

Guy I'm not sure this is working correctly. From the two screenshots we see that Tag Counters found, for example, 118 matches for Function Defined, but the first screenshot has no confidence, N/A and no light up for function defined. What does the indicator in the first screenshot mean if its not related to these numbers in the second one?

@guyacosta
Copy link
Contributor

Metrics are not supported in the Feature UI page hence the partial result. I suppose I can fix that and block them from appearing at all. I'll reopen as a bug but will not be displaying metrics on that page.

@guyacosta guyacosta reopened this Sep 16, 2020
@guyacosta
Copy link
Contributor

guyacosta commented Sep 16, 2020

Basically, each Metric or counter is excluded from the details match results only the tag is counted but because the tag was added to the UI group it partially appears with no data...just didn't block it from being added as a tag group and it should due to aforementioned reasons. Thanks I'll fix that aspect.

@guyacosta guyacosta added bug Something isn't working and removed working as designed labels Sep 16, 2020
@guyacosta
Copy link
Contributor

Final comment to help explain that an early design decision not include include metrics in the detailed report is that they would appear as noise throughout the json report with each instance taking up space when we just want a count. Again, the primary purpose is to identify features. The exclusion of these from the detailed matches is what creates the empty data rows in the features page today because we didn't intend for them to appear here, only the tag counters area. Hope that helps.

@guyacosta
Copy link
Contributor

One other change that was made a few versions back is we no longer need the tagcounters.json to define the behavior to automatically count anything with the tag section containing "metric" and not include it in the detailed reports. Looks like my documentation didn't get updated which is part of the reason for the confusion so I've corrected that in the tags section of the wiki and in the custom reports section.

@marc-patterson
Copy link
Author

Thanks for taking the time to reply, and for updating the docs.

In my opinion it's a shame that the option to include metrics in the detailed report was removed, as we'd find this information useful in our use case.

@guyacosta
Copy link
Contributor

The information is still available just not on the "features" page which represents functionality only and is tied to the detailed matches in the report. I do understand it's just in this case there is a design/intent conflict but hope you enjoy the tool and can make use of the counters info found on the summary subpage of the html report and in the json/text formats.

@guyacosta
Copy link
Contributor

Detection and warning added to log. Final doc updated.

guyacosta pushed a commit that referenced this issue Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants