simplelocalize/simplelocalize-cli

View on GitHub

Showing 17 of 17 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 41 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

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

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

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

        package io.simplelocalize.cli.processor.processor;
        
        import com.google.common.collect.Sets;
        import io.simplelocalize.cli.processor.ProcessResult;
        import io.simplelocalize.cli.processor.ProjectProcessor;
        src/main/java/io/simplelocalize/cli/processor/processor/YahooReactIntlProcessor.java on lines 1..35

        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.processor.processor;
        
        import com.google.common.collect.Sets;
        import io.simplelocalize.cli.processor.ProcessResult;
        import io.simplelocalize.cli.processor.ProjectProcessor;
        src/main/java/io/simplelocalize/cli/processor/processor/IEighteenNextProcessor.java on lines 1..34

        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 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 getMatchingFilesToUpload has 28 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();
                File file = uploadPathWithTemplateKey.toFile();
                File parentDirectoryFile = file.getParentFile();
            Severity: Minor
            Found in src/main/java/io/simplelocalize/cli/util/FileReaderUtil.java - About 1 hr to fix

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

                private static void unzipFiles(String zipFilePath, String destinationPath) throws IOException
                {
                  byte[] buffer = new byte[1024];
                  try (ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(zipFilePath)))
                  {
              Severity: Minor
              Found in src/main/java/io/simplelocalize/cli/util/ZipUtils.java - About 1 hr to fix

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

                package io.simplelocalize.cli.processor.keys;
                
                import io.simplelocalize.cli.util.FileContentUtil;
                import io.simplelocalize.cli.util.FileReaderUtil;
                
                
                src/main/java/io/simplelocalize/cli/processor/keys/AndroidXmlKeysExtractor.java on lines 1..30
                src/main/java/io/simplelocalize/cli/processor/keys/SwiftStringKeyExtractor.java on lines 1..31

                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.processor.keys;
                
                import io.simplelocalize.cli.util.FileContentUtil;
                import io.simplelocalize.cli.util.FileReaderUtil;
                
                
                src/main/java/io/simplelocalize/cli/processor/keys/AndroidRStringKeyExtractor.java on lines 1..28
                src/main/java/io/simplelocalize/cli/processor/keys/AndroidXmlKeysExtractor.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.processor.keys;
                
                import io.simplelocalize.cli.processor.keys.KeyExtractor;
                import io.simplelocalize.cli.util.FileContentUtil;
                import io.simplelocalize.cli.util.FileReaderUtil;
                src/main/java/io/simplelocalize/cli/processor/keys/AndroidRStringKeyExtractor.java on lines 1..28
                src/main/java/io/simplelocalize/cli/processor/keys/SwiftStringKeyExtractor.java on lines 1..31

                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 invoke has a Cognitive Complexity of 8 (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 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 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

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

                    public void downloadFile(Path downloadPath, String downloadFormat, String languageKey) throws IOException, InterruptedException
                    {
                      String endpointUrl = API_URL + "/cli/v1/download?downloadFormat=" + downloadFormat;
                      if (StringUtils.isNotEmpty(languageKey))
                      {
                  Severity: Minor
                  Found in src/main/java/io/simplelocalize/cli/client/SimpleLocalizeClient.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

                  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/processor/keys/ReactIntlKeyExtractor.java on lines 55..62

                  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/processor/keys/EjsKeyExtractor.java on lines 22..29

                  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