cqfn / veniq

Veniq uses Machine Learning to analyze source code, find possible refactorings, and suggest those that seem optimal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inline problems

Vitaly-Protasov opened this issue · comments

We have such problem in our currently inline script:

  • Cannot inline those methods or invokation, which is defined in one row with some other statements:
    (problem to insert body of hasMore() invokation)
 public Vector getWordVector(char[] separators)
   {  Vector list=new Vector();
      do { list.addElement(getWord(separators)); } while (hasMore());
      return list;
   }

  • Problem to extract body of this method: one-line several statements in a row
    public String getRemainingString() { return str.substring(index); }

  • Problem with output new inserted blocks

            if (ic == null) {
                // it must be unrecognized setting
        name = NbBundle.getMessage(InstanceNode.class,

When it was:

            if (ic == null) {
                // it must be unrecognized setting
                return NbBundle.getMessage(InstanceNode.class,
                    "LBL_BrokenSettings"); //NOI18N
  • Problem to detect the last line of methods at the end of file
    private void resetFactories() {
        if (ppFactories == null) {
            ppFactories = ProfilingPointsManager.getDefault().getProfilingPointFactories();
            getChooserFrame().initPanel(ppFactories);
        }

        currentFactory = 0;
    }
}
  • Problem to Inline such method invocaitons
    if (!isProcessExternalEntities()) {

  • Still, there're a lot of problems is insertion with brackets.

  • FIX writing into csv

  File ".\veniq\dataset_collection\augmentation.py", line 427, in <module>
    writer.writerow(i)
  File "C:\Users\Vitaly\Anaconda3\lib\encodings\cp1251.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 158-161: character maps to <undefined>

(In ivocation line may contains chines symbols in comments)

  • Problem to inline methods with massive comments inside at the end of method declaration:
/*
        } else {
              pass
        }
*/