pedroMMM/goss

View on GitHub
system/file.go

Summary

Maintainability
C
1 day
Test Coverage

Method DefFile.Filetype has 5 return statements (exceeds 4 allowed).
Open

func (f *DefFile) Filetype() (string, error) {
    if err := f.setup(); err != nil {
        return "", err
    }

Severity: Major
Found in system/file.go - About 35 mins to fix

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

    func (f *DefFile) Md5() (string, error) {
    
        if err := f.setup(); err != nil {
            return "", err
        }
    Severity: Major
    Found in system/file.go and 1 other location - About 1 hr to fix
    system/file.go on lines 242..260

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

    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 (f *DefFile) Sha256() (string, error) {
    
        if err := f.setup(); err != nil {
            return "", err
        }
    Severity: Major
    Found in system/file.go and 1 other location - About 1 hr to fix
    system/file.go on lines 222..240

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

    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 (f *DefFile) Owner() (string, error) {
        if err := f.setup(); err != nil {
            return "", err
        }
    
    
    Severity: Major
    Found in system/file.go and 1 other location - About 1 hr to fix
    system/file.go on lines 167..183

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

    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 (f *DefFile) Group() (string, error) {
        if err := f.setup(); err != nil {
            return "", err
        }
    
    
    Severity: Major
    Found in system/file.go and 1 other location - About 1 hr to fix
    system/file.go on lines 149..165

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

    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 getGroupForGid(gid int) (string, error) {
        if group, err := user.LookupGid(gid); err == nil {
            return group.Name, nil
        }
    
    
    Severity: Major
    Found in system/file.go and 1 other location - About 1 hr to fix
    system/file.go on lines 262..274

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

    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 getUserForUid(uid int) (string, error) {
        if user, err := user.LookupUid(uid); err == nil {
            return user.Name, nil
        }
    
    
    Severity: Major
    Found in system/file.go and 1 other location - About 1 hr to fix
    system/file.go on lines 276..288

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

    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

    exported function NewDefFile should have comment or be unexported
    Open

    func NewDefFile(path string, system *System, config util.Config) File {
    Severity: Minor
    Found in system/file.go by golint

    exported method DefFile.Exists should have comment or be unexported
    Open

    func (f *DefFile) Exists() (bool, error) {
    Severity: Minor
    Found in system/file.go by golint

    exported method DefFile.LinkedTo should have comment or be unexported
    Open

    func (f *DefFile) LinkedTo() (string, error) {
    Severity: Minor
    Found in system/file.go by golint

    exported method DefFile.Filetype should have comment or be unexported
    Open

    func (f *DefFile) Filetype() (string, error) {
    Severity: Minor
    Found in system/file.go by golint

    exported method DefFile.Md5 should have comment or be unexported
    Open

    func (f *DefFile) Md5() (string, error) {
    Severity: Minor
    Found in system/file.go by golint

    exported type DefFile should have comment or be unexported
    Open

    type DefFile struct {
    Severity: Minor
    Found in system/file.go by golint

    exported method DefFile.Group should have comment or be unexported
    Open

    func (f *DefFile) Group() (string, error) {
    Severity: Minor
    Found in system/file.go by golint

    exported type File should have comment or be unexported
    Open

    type File interface {
    Severity: Minor
    Found in system/file.go by golint

    exported method DefFile.Mode should have comment or be unexported
    Open

    func (f *DefFile) Mode() (string, error) {
    Severity: Minor
    Found in system/file.go by golint

    exported method DefFile.Owner should have comment or be unexported
    Open

    func (f *DefFile) Owner() (string, error) {
    Severity: Minor
    Found in system/file.go by golint

    exported method DefFile.Path should have comment or be unexported
    Open

    func (f *DefFile) Path() string {
    Severity: Minor
    Found in system/file.go by golint

    exported method DefFile.Sha256 should have comment or be unexported
    Open

    func (f *DefFile) Sha256() (string, error) {
    Severity: Minor
    Found in system/file.go by golint

    exported method DefFile.Size should have comment or be unexported
    Open

    func (f *DefFile) Size() (int, error) {
    Severity: Minor
    Found in system/file.go by golint

    func getUserForUid should be getUserForUID
    Open

    func getUserForUid(uid int) (string, error) {
    Severity: Minor
    Found in system/file.go by golint

    exported method DefFile.Contains should have comment or be unexported
    Open

    func (f *DefFile) Contains() (io.Reader, error) {
    Severity: Minor
    Found in system/file.go by golint

    There are no issues that match your filters.

    Category
    Status