Class BugRanker


  • public class BugRanker
    extends java.lang.Object
    Bug rankers are used to compute a bug rank for each bug instance. Bug ranks 1-20 are for bugs that are visible to users. Bug rank 1 is more the most relevant/scary bugs. A bug rank greater than 20 is for issues that should not be shown to users. The following bug rankers may exist:
    • core bug ranker (loaded from etc/bugrank.txt)
    • a bug ranker for each plugin (loaded from <plugin>/etc/bugrank.txt)
    • A global adjustment ranker (loaded from plugins/adjustBugrank.txt)
    A bug ranker is comprised of a list of bug patterns, bug kinds and bug categories. For each, either an absolute or relative bug rank is provided. A relative rank is one preceded by a + or -. For core bug detectors, the bug ranker search order is:
    • global adjustment bug ranker
    • core bug ranker
    For third party plugins, the bug ranker search order is:
    • global adjustment bug ranker
    • plugin adjustment bug ranker
    • core bug ranker
    The overall search order is
    • Bug patterns, in search order across bug rankers
    • Bug kinds, in search order across bug rankers
    • Bug categories, in search order across bug rankers
    Search stops at the first absolute bug rank found, and the result is the sum of all of relative bug ranks plus the final absolute bug rank. Since all bug categories are defined by the core bug ranker, we should always find an absolute bug rank.
    See Also:
    BugRankCategory, Priorities, Confidence
    • Constructor Detail

      • BugRanker

        BugRanker​(@CheckForNull
                  java.net.URL u)
           throws java.io.IOException
        Parameters:
        u - may be null. In this case, a default value will be used for all bugs
        Throws:
        java.io.IOException
    • Method Detail

      • priorityAdjustment

        private static int priorityAdjustment​(int priority)
      • adjustRank

        private static int adjustRank​(int patternRank,
                                      int priority)
      • rankBugPattern

        private static int rankBugPattern​(BugPattern bugPattern,
                                          BugRanker... rankers)
      • getCoreRanker

        private static BugRanker getCoreRanker()
      • findRank

        public static int findRank​(BugInstance bug)
      • findRank

        public static int findRank​(BugPattern bugPattern,
                                   int priority)
      • findRankUnknownPlugin

        private static int findRankUnknownPlugin​(BugPattern pattern)
      • trimToMaxRank

        public static void trimToMaxRank​(BugCollection origCollection,
                                         int maxRank)