simplelocalize/simplelocalize-cli

View on GitHub

Showing 10 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))
          {

        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

                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

                  Severity
                  Category
                  Status
                  Source
                  Language