simplelocalize/simplelocalize-cli

View on GitHub

Showing 33 of 33 total issues

Method publish has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  @Command(
          name = "publish",
          description = "Publish translations to Translation Hosting. Use 'simplelocalize publish --help' to learn more about the parameters.")
  public void publish(
          @Option(names = {"--apiKey"}, description = "Project API Key") String apiKey,
Severity: Minor
Found in src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.java - About 1 hr to fix

    Method download has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

              @Option(names = {"--apiKey"}, description = "Project API Key") String apiKey,
              @Option(names = {"--downloadPath"}, description = "Directory where translations should be downloaded") String downloadPath,
              @Option(names = {"--downloadFormat"}, description = "Translations file format") String downloadFormat,
              @Option(names = {"--downloadOptions"}, split = ",", description = "(Optional) Download options") List<String> downloadOptions,
              @Option(names = {"--downloadSort"}, description = "(Optional) Download sorting") String downloadSort,
    Severity: Major
    Found in src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.java - About 1 hr to fix

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

                @Option(names = {"--apiKey"}, description = "Project API Key") String apiKey,
                @Option(names = {"--pullPath"}, description = "Directory where translations should be saved") String pullPath,
                @Option(names = {"--environment"}, description = "Translation Hosting environment ('latest' or 'production')") String environment,
                @Option(names = {"--filterRegex"}, description = "(Optional) Filter which resources should be downloaded") String filterRegex,
                @Option(names = {"--baseUrl"}, description = "(Optional) Set custom server URL") String baseUrl
      Severity: Minor
      Found in src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.java - About 35 mins to fix

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

          public void invoke() throws IOException, InterruptedException
          {
            String responseData = client.fetchProject();
            DocumentContext json = jsonReader.read(responseData);
        
        
        Severity: Minor
        Found in src/main/java/io/simplelocalize/cli/command/PullHostingCommand.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/extraction/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/extraction/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

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

            for (Path javaFile : combinedLists)
            {
              Set<String> chunk = DefaultKeysExtractor.extractValuesByPattern(javaFile, Pattern.compile("(?<=R\\.string\\.)(.*?)(?=\\))"));
              output.addAll(ExtractionResult.fromCollection(chunk, javaFile));
            }
        src/main/java/io/simplelocalize/cli/extraction/processor/AndroidProcessor.java on lines 33..37
        src/main/java/io/simplelocalize/cli/extraction/processor/AppleProcessor.java on lines 22..26

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

        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

            for (Path path : swiftFiles)
            {
              Set<String> chunk = DefaultKeysExtractor.extractValuesByPattern(path, Pattern.compile("(?<=NSLocalizedString\\(\")(.*?)(?=\")"));
              output.addAll(ExtractionResult.fromCollection(chunk, path));
            }
        src/main/java/io/simplelocalize/cli/extraction/processor/AndroidProcessor.java on lines 26..30
        src/main/java/io/simplelocalize/cli/extraction/processor/AndroidProcessor.java on lines 33..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 42.

        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

            for (Path xmlFile : xmlFiles)
            {
              Set<String> chunk = DefaultKeysExtractor.extractValuesByPattern(xmlFile, Pattern.compile("(?<=android:text=\"@string/)(.*?)(?=\")"));
              output.addAll(ExtractionResult.fromCollection(chunk, xmlFile));
            }
        src/main/java/io/simplelocalize/cli/extraction/processor/AndroidProcessor.java on lines 26..30
        src/main/java/io/simplelocalize/cli/extraction/processor/AppleProcessor.java on lines 22..26

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

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

          private boolean isMultiLanguage(Configuration configuration)
          {
            List<String> multiLanguageFileFormats = List.of("multi-language-json", "excel", "csv-translations");
            for (String uploadFormat : multiLanguageFileFormats)
            {
        Severity: Minor
        Found in src/main/java/io/simplelocalize/cli/command/UploadCommand.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 trySendException has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          private void trySendException(Exception exception)
          {
            try
            {
              SimpleLocalizeClient client = SimpleLocalizeClient.create(effectiveCommandConfiguration.getBaseUrl(), effectiveCommandConfiguration.getApiKey());
        Severity: Minor
        Found in src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.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 createHttpClient has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          public static HttpClient createHttpClient()
          {
            HttpClient.Builder builder = HttpClient
                    .newBuilder()
                    .connectTimeout(Duration.ofMinutes(5));
        Severity: Minor
        Found in src/main/java/io/simplelocalize/cli/client/HttpClientFactory.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 pull has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          @Command(
                  name = "pull",
                  description = "Pull translations from Translation Hosting Use 'simplelocalize pull --help' to learn more about the parameters.")
          public void pull(
                  @Option(names = {"--apiKey"}, description = "Project API Key") String apiKey,
        Severity: Minor
        Found in src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.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