PuzaTech/Fugue

View on GitHub

Showing 35 of 52 total issues

Method setMessage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    @SuppressWarnings("unchecked")
    public void setMessage(Message m) {
        cmdArg = m;
        String randomGNRStr = cmdArg.getParam("random").toString();
Severity: Minor
Found in src/main/java/com/hongliangjie/fugue/topicmodeling/LDA/LDA.java - About 1 hr to fix

    Method likelihood has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public double likelihood(List<int[]> wordTopicCounts, List<int[]> docTopicBuffers, double[] alpha, double[] beta, double alphaSum, double betaSum) {
            double result_1 = 0.0;
            double result_2 = 0.0;
    
            // topics side likelihood
    Severity: Minor
    Found in src/main/java/com/hongliangjie/fugue/topicmodeling/LDA/LDA.java - About 1 hr to fix

      Method loadModel has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          @SuppressWarnings("unchecked")
          public void loadModel() throws IOException {
              int multipleModels = Integer.parseInt(cmdArg.getParam("multipleModels").toString());
              String[] modelFileNames = null;
              LOGGER.info("Load Multiple Test Models:" + multipleModels);
      Severity: Minor
      Found in src/main/java/com/hongliangjie/fugue/topicmodeling/LDA/LDA.java - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method sampleOverDocs has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              public void sampleOverDocs(int modelID, List<Document> docs, int start, int end, int maxIter, int save){
      Severity: Minor
      Found in src/main/java/com/hongliangjie/fugue/topicmodeling/LDA/LDA.java - About 45 mins to fix

        Method sampleOverDocs has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                public void sampleOverDocs(int modelID, List<Document> docs, int start, int end, int maxIter, int save){
        Severity: Minor
        Found in src/main/java/com/hongliangjie/fugue/topicmodeling/LDA/LDA.java - About 45 mins to fix

          Method likelihood has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public double likelihood(List<int[]> wordTopicCounts, List<int[]> docTopicBuffers, double[] alpha, double[] beta, double alphaSum, double betaSum) {
                  double result_1 = 0.0;
                  double result_2 = 0.0;
          
                  // topics side likelihood
          Severity: Minor
          Found in src/main/java/com/hongliangjie/fugue/topicmodeling/LDA/LDA.java - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method logSumAll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public double logSumAll(double[] x) {
                  double maximum = 0;
                  for (int i = 0; i < x.length; i++) {
                      if (i == 0) {
                          maximum = x[i];
          Severity: Minor
          Found in src/main/java/com/hongliangjie/fugue/utils/LogUtils.java - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method likelihood has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public double likelihood(List<int[]> wordTopicCounts, List<int[]> docTopicBuffers, double[] alpha, double[] beta, double alphaSum, double betaSum) {
          Severity: Minor
          Found in src/main/java/com/hongliangjie/fugue/topicmodeling/LDA/LDA.java - About 45 mins to fix

            Method getSampler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                protected Sampler getSampler(String samplerStr){
                    Sampler s = null;
                    if (samplerStr != null) {
                        if ("normal".equals(samplerStr)) {
                            s = new GibbsSampling();
            Severity: Minor
            Found in src/main/java/com/hongliangjie/fugue/topicmodeling/LDA/LDA.java - About 35 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method rebuildIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public void rebuildIndex(){
                    /* build index */
                    LOGGER.info("Start to build index.");
                    wordsForwardIndex = new HashMap<String, Integer>();
                    wordsForwardIndex.clear();
            Severity: Minor
            Found in src/main/java/com/hongliangjie/fugue/topicmodeling/LDA/LDA.java - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method initTrainModel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected void initTrainModel() {
                    rebuildIndex();
                    LOGGER.info("Start to initialize model.");
                    LOGGER.info("Topic Num:" + TOPIC_NUM);
                    LOGGER.info("ForwardIndex Size:" + wordsForwardIndex.size());
            Severity: Minor
            Found in src/main/java/com/hongliangjie/fugue/topicmodeling/LDA/LDA.java - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function load_raw has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def load_raw(args):
                input_f = open(args.input_file, 'r')
                docs = []
                for line in input_f:
                    if line.strip()!='':
            Severity: Minor
            Found in src/main/python/tm.py - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method setMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                @SuppressWarnings("unchecked")
                public void setMessage(Message m) {
                    cmdArg = m;
                    String randomGNRStr = cmdArg.getParam("random").toString();
            Severity: Minor
            Found in src/main/java/com/hongliangjie/fugue/topicmodeling/LDA/LDA.java - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function load_model has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def load_model(model_filename):
                json_file_content = ''
                input_f = open(model_filename, 'r')
                for line in input_f:
                    json_file_content += line.strip()
            Severity: Minor
            Found in src/main/python/tm.py - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method performTask has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public void performTask(){
            
                    DataReader r = new DataReader();
                    LOGGER.info("Start to read documents.");
                    try {
            Severity: Minor
            Found in src/main/java/com/hongliangjie/fugue/topicmodeling/TopicModelDriver.java - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Severity
            Category
            Status
            Source
            Language