eljoujat/eclipseimpexeditor

View on GitHub

Showing 46 of 46 total issues

Method createProposals has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    private CompletionProposal[] createProposals(final String searchPrefix, final int documentOffset,
            final IContextInformation info)
    {
        final List<String> result = new ArrayList<String>();

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 format has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public String format(String content, ImpexDataDefinition impexDataDefinition) {

        Scanner scanner = new Scanner(content);
        List<AbstractBloc> impexBlocs = new ArrayList<>();
        StringBuilder sb=new StringBuilder();

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 evaluateInternal has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public IToken evaluateInternal(ImpexScanner scanner) {
        
        if(scanner.getState().equals("data")){
            return Token.UNDEFINED;
        }

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 evaluateInternal has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public IToken evaluateInternal(ImpexScanner scanner) {
        
        if(scanner.getState().equals("data")){
            return Token.UNDEFINED;
        }

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 isHeaderColumn has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean isHeaderColumn(String entry,String itemType) {

        final List<String> result = new ArrayList<String>();
        boolean isheader=false;

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 buildHttpClient has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public HttpClient buildHttpClient() {
        HttpClient client = null;
        SSLContext sslContext = null;
        try {

    Method format has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public String format(String content, ImpexDataDefinition impexDataDefinition) {
    
            Scanner scanner = new Scanner(content);
            List<AbstractBloc> impexBlocs = new ArrayList<>();
            StringBuilder sb=new StringBuilder();

      Method createProposals has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private CompletionProposal[] createProposals(final String searchPrefix, final int documentOffset,
                  final IContextInformation info)
          {
              final List<String> result = new ArrayList<String>();
      
      

        Method evaluateInternal has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public IToken evaluateInternal(ImpexScanner scanner) {
        
                    String stream = "";
                    int c = scanner.read();
                    int count = 1;

        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 getMaxLengthPerColumn has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            Map<Integer, Integer> getMaxLengthPerColumn() {
                List<ImpexLine> lines = getLines();
                Map<Integer, Integer> maxLengthPerLine = new HashMap<>();
                for (ImpexLine impexLine : lines) {
                    for (int i = 0; i < impexLine.getEntries().size(); i++) {

        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

        Consider simplifying this complex logical expression.
        Open

                                if((']'== c || ')'==c || '='==c || '['==c || '('==c  || ';'==c ||c=='\n' ||c=='\r' )){
                                    scanner.unread();
                                    impexDataDefinition.addVariableDecalration(stream);
                                    scanner.setState("variable");
                                    return token;

          Method evaluateInternal has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public IToken evaluateInternal(ImpexScanner scanner) {
                  
                  if(scanner.getState().equals("data")){
                      return Token.UNDEFINED;
                  }

            Method evaluateInternal has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public IToken evaluateInternal(ImpexScanner scanner) {
                    
                    if(scanner.getState().equals("data")){
                        return Token.UNDEFINED;
                    }

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

                  private String sendLoginPost() {
              
                      final String validJSessionID = getValidJSessionID();
                      String csrfToken = null;
                      try {

                Method sendLoginPost has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    private String sendLoginPost() {
                
                        final String validJSessionID = getValidJSessionID();
                        String csrfToken = null;
                        try {

                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 disableSSLCertificateChecking has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static void disableSSLCertificateChecking() {
                        HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
                
                            @Override
                            public boolean verify(String hostname, SSLSession session) {

                  Method evaluateInternal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public IToken evaluateInternal(ImpexScanner scanner) {
                  
                              String stream = "";
                              int c = scanner.read();
                              int count = 1;

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                    if (var.toUpperCase().startsWith(searchPrefix.toUpperCase()) && !result.contains(var))
                                    {
                                        final Image image = Activator.getDefault().getImageRegistry().get(ImpexColorConstants.TYPE_IMAGE_ID);
                                        proposals.add(createProposal(documentOffset, searchPrefix, var, info, image));
                                        result.add(var);
                    impexeditor.core/src/main/java/org/eclipseplugins/impexeditor/core/editor/autocompletion/ImpexCompletionProposalComputer.java on lines 123..128

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 68.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                if (headerTyp.toUpperCase().startsWith(searchPrefix.toUpperCase()) && !result.contains(headerTyp))
                                {
                                    final Image image = Activator.getDefault().getImageRegistry().get(ImpexColorConstants.TYPE_IMAGE_ID);
                                    proposals.add(createProposal(documentOffset, searchPrefix, headerTyp, info, image));
                                    result.add(headerTyp);
                    impexeditor.core/src/main/java/org/eclipseplugins/impexeditor/core/editor/autocompletion/ImpexCompletionProposalComputer.java on lines 142..147

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 68.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                            if ( (c != -1)
                                    && (this.fDetector.isWordStart((char) c))
                                    && (((this.fColumn == -1) || (this.fColumn == scanner
                                            .getColumn() - 1)))) {
                    impexeditor.core/src/main/java/org/eclipseplugins/impexeditor/core/editor/rules/ImpexHeaderRule.java on lines 48..51

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 60.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language