simplelocalize/simplelocalize-cli

View on GitHub

Showing 9 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

      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

              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
                  Severity
                  Category
                  Status
                  Source
                  Language