simplelocalize/simplelocalize-cli

View on GitHub

Showing 18 of 18 total issues

Configuration has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

@Introspected
public class Configuration {

  private String apiKey;
  private String uploadToken;
Severity: Minor
Found in src/main/java/io/simplelocalize/cli/configuration/Configuration.java - About 3 hrs to fix

    Method invoke has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public void invoke(Configuration configuration)
      {
        Path configurationUploadPath = configuration.getUploadPath();
        String apiKey = configuration.getApiKey();
        String profile = configuration.getProfile();
    Severity: Minor
    Found in src/main/java/io/simplelocalize/cli/command/UploadCommand.java - About 1 hr to fix

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

      package io.simplelocalize.cli.extraction.processor;
      
      import com.google.common.collect.Sets;
      import io.simplelocalize.cli.extraction.ExtractionResult;
      import io.simplelocalize.cli.extraction.files.JavaScriptAndTypeScriptFilesFinder;
      src/main/java/io/simplelocalize/cli/extraction/processor/IEighteenNextProcessor.java on lines 1..36

      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 92.

      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

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

      package io.simplelocalize.cli.extraction.processor;
      
      import com.google.common.collect.Sets;
      import io.simplelocalize.cli.extraction.ExtractionResult;
      import io.simplelocalize.cli.extraction.files.JavaScriptAndTypeScriptFilesFinder;
      src/main/java/io/simplelocalize/cli/extraction/processor/YahooReactIntlProcessor.java on lines 1..37

      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 92.

      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

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

        public void downloadFile(Path downloadPath, String downloadFormat, String languageKey) throws IOException, InterruptedException
        {
          String endpointUrl = baseUrl + "/cli/v1/download?downloadFormat=" + downloadFormat;
          boolean isRequestedTranslationsForSpecificLanguage = StringUtils.isNotEmpty(languageKey);
          if (isRequestedTranslationsForSpecificLanguage)

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

          public static List<FileToUpload> getMatchingFilesToUpload(Path uploadPathWithTemplateKey, String templateKey) throws IOException
          {
            List<FileToUpload> output = Lists.newArrayList();
            String filePathWithTemplate = uploadPathWithTemplateKey.toString();
        
        
        Severity: Minor
        Found in src/main/java/io/simplelocalize/cli/util/FileListReaderUtil.java - About 1 hr to fix

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

            public void uploadFile(Path uploadPath, String languageKey, String uploadFormat, String uploadOptions) throws IOException, InterruptedException
            {
              int pseudoRandomNumber = (int) (random.nextDouble() * 1_000_000_000);
              String boundary = "simplelocalize" + pseudoRandomNumber;
              Map<Object, Object> formData = Maps.newHashMap();

            Method load has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private Configuration load(Path configurationFilePath)
              {
                File file = new File(URLDecoder.decode(String.valueOf(configurationFilePath.toFile()), StandardCharsets.UTF_8));
                Constructor yamlTargetClass = new Constructor(Configuration.class);
                Yaml yaml = new Yaml(yamlTargetClass);

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

                public void invoke(Configuration configuration)
                {
                  Path configurationUploadPath = configuration.getUploadPath();
                  String apiKey = configuration.getApiKey();
                  String profile = configuration.getProfile();
              Severity: Minor
              Found in src/main/java/io/simplelocalize/cli/command/UploadCommand.java - About 1 hr 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

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

                @Override
                public boolean equals(Object o)
                {
                  if (this == o) return true;
                  if (o == null || getClass() != o.getClass()) return false;
              src/main/java/io/simplelocalize/cli/extraction/ExtractionResult.java on lines 38..45

              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 72.

              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

                @Override
                public boolean equals(Object o)
                {
                  if (this == o) return true;
                  if (o == null || getClass() != o.getClass()) return false;
              src/main/java/io/simplelocalize/cli/client/dto/FileToUpload.java on lines 33..40

              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 72.

              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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              package io.simplelocalize.cli.extraction.keys;
              
              import io.simplelocalize.cli.util.FileContentUtil;
              
              import java.nio.file.Path;
              src/main/java/io/simplelocalize/cli/extraction/keys/AndroidXmlKeysExtractor.java on lines 1..28
              src/main/java/io/simplelocalize/cli/extraction/keys/SwiftStringKeyExtractor.java on lines 1..30

              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 67.

              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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              package io.simplelocalize.cli.extraction.keys;
              
              import io.simplelocalize.cli.util.FileContentUtil;
              
              import java.nio.file.Path;
              src/main/java/io/simplelocalize/cli/extraction/keys/AndroidRStringKeyExtractor.java on lines 1..27
              src/main/java/io/simplelocalize/cli/extraction/keys/AndroidXmlKeysExtractor.java on lines 1..28

              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 67.

              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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              package io.simplelocalize.cli.extraction.keys;
              
              import io.simplelocalize.cli.util.FileContentUtil;
              
              import java.nio.file.Path;
              src/main/java/io/simplelocalize/cli/extraction/keys/AndroidRStringKeyExtractor.java on lines 1..27
              src/main/java/io/simplelocalize/cli/extraction/keys/SwiftStringKeyExtractor.java on lines 1..30

              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 67.

              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

              Method sync has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                        @Option(names = {"--apiKey"}, description = "Project API Key") String apiKey,
                        @Option(names = {"--uploadPath"}, description = "Path to file with translation or translation keys to upload. Use '{lang}' to define language key if you are uploading more than one file with translations.") Path uploadPath,
                        @Option(names = {"--uploadFormat"}, description = "Translations or keys format") String uploadFormat,
                        @Option(names = {"--uploadOptions"}, description = "(Optional) Read more about 'uploadOptions' param at docs.simplelocalize.io") String uploadOptions,
                        @Option(names = {"--downloadPath"}, description = "Directory where translations should be downloaded") Path downloadPath,
              Severity: Major
              Found in src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.java - About 50 mins to fix

                Method upload has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                          @Option(names = {"--apiKey"}, description = "Project API Key") String apiKey,
                          @Option(names = {"--uploadPath"}, description = "Path to file with translation or translation keys to upload. Use '{lang}' to define language key if you are uploading more than one file with translations.") Path uploadPath,
                          @Option(names = {"--uploadFormat"}, description = "Translations or keys format") String uploadFormat,
                          @Option(names = {"--languageKey"}, description = "(Optional) Specify language key for single file upload") String languageKey,
                          @Option(names = {"--uploadOptions"}, description = "(Optional) Read more about 'uploadOptions' param at docs.simplelocalize.io") String uploadOptions
                Severity: Minor
                Found in src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.java - About 35 mins to fix

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

                    private Set<String> matchI18n(String fileContent) {
                      fileContent = fileContent.replaceAll("\\s+", "");
                      return Pattern.compile("(?<=<%=i18n\\.)(.*?)(?=%>)")
                              .matcher(fileContent)
                              .results()
                  src/main/java/io/simplelocalize/cli/extraction/keys/ReactIntlKeyExtractor.java on lines 54..61

                  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 44.

                  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

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

                    private Set<String> matchIntlFormatMessageIds(String fileContent) {
                      fileContent = fileContent.replaceAll("\\s+", "");
                      return Pattern.compile("(?<=intl\\.formatMessage\\(\\{id:[\"|'])(.*?)(?=[\"|'])")
                              .matcher(fileContent)
                              .results()
                  src/main/java/io/simplelocalize/cli/extraction/keys/EjsKeyExtractor.java on lines 21..28

                  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 44.

                  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