joshuacc/ahkpm

View on GitHub

Showing 7 of 7 total issues

Method Initializer.InitInteractively has 76 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (i Initializer) InitInteractively() {
    manifest := GetNewManifestWithDefaults()

    for {
        manifest.Version = showPrompt(
Severity: Major
Found in src/core/initializer.go - About 2 hrs to fix

    Method packagesRepository.ensurePackageIsReady has 58 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (pr *packagesRepository) ensurePackageIsReady(depName string, depVersionString string) error {
        repo, previouslyCloned, err := pr.ensurePackageIsUpToDate(depName)
        if err != nil {
            return err
        }
    Severity: Minor
    Found in src/core/packages_repository.go - About 1 hr to fix

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

      func getDefaultAuthorName() string {
          out, err := exec.Command("git", "rev-parse", "--is-inside-work-tree").Output()
          if err == nil && string(out) == "true\n" {
              userName, err := exec.Command("git", "config", "--get", "user.name").Output()
              if err == nil && string(userName) != "" {
      Severity: Minor
      Found in src/core/initializer.go and 1 other location - About 1 hr to fix
      src/core/initializer.go on lines 294..304

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

      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

      func getDefaultAuthorEmail() string {
          out, err := exec.Command("git", "rev-parse", "--is-inside-work-tree").Output()
          if err == nil && string(out) == "true\n" {
              email, err := exec.Command("git", "config", "--get", "user.email").Output()
              if err == nil && string(email) != "" {
      Severity: Minor
      Found in src/core/initializer.go and 1 other location - About 1 hr to fix
      src/core/initializer.go on lines 282..292

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

      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

      Avoid deeply nested control flow statements.
      Open

          } else if utils.IsSemVerRange(versionSpecifier) {
              v.kind = SemVerRange
              v.value = getLegibleRange(versionSpecifier)
          } else {
              return v, errors.New("Invalid version specifier " + versionSpecifier)
      Severity: Major
      Found in src/core/version.go - About 45 mins to fix

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

        func (lm LockManifest) SaveToCwd() LockManifest {
            jsonBytes, err := json.MarshalIndent(lm, "", "  ")
            if err != nil {
                utils.Exit("Error marshalling ahkpm.lock to bytes")
            }
        Severity: Minor
        Found in src/core/lock_manifest.go and 1 other location - About 30 mins to fix
        src/core/manifest.go on lines 58..68

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

        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

        func (m Manifest) SaveToCwd() Manifest {
            jsonBytes, err := json.MarshalIndent(m, "", "  ")
            if err != nil {
                utils.Exit("Error marshalling ahkpm.json to bytes")
            }
        Severity: Minor
        Found in src/core/manifest.go and 1 other location - About 30 mins to fix
        src/core/lock_manifest.go on lines 34..44

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

        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