jkawamoto/roadie

View on GitHub
cloud/storage.go

Summary

Maintainability
B
5 hrs
Test Coverage

Method Storage.DownloadFiles has 61 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (s *Storage) DownloadFiles(ctx context.Context, prefix *url.URL, dir string, queries []string) (err error) {

    var info os.FileInfo
    if info, err = os.Stat(dir); err != nil {
        // Given dir does not exist.
Severity: Minor
Found in cloud/storage.go - About 1 hr to fix

    Method Storage.DownloadFiles has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *Storage) DownloadFiles(ctx context.Context, prefix *url.URL, dir string, queries []string) (err error) {
    
        var info os.FileInfo
        if info, err = os.Stat(dir); err != nil {
            // Given dir does not exist.
    Severity: Minor
    Found in cloud/storage.go - 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 Storage.DownloadFiles has 9 return statements (exceeds 4 allowed).
    Open

    func (s *Storage) DownloadFiles(ctx context.Context, prefix *url.URL, dir string, queries []string) (err error) {
    
        var info os.FileInfo
        if info, err = os.Stat(dir); err != nil {
            // Given dir does not exist.
    Severity: Major
    Found in cloud/storage.go - About 55 mins to fix

      Method Storage.DeleteFiles has 6 return statements (exceeds 4 allowed).
      Open

      func (s *Storage) DeleteFiles(ctx context.Context, prefix *url.URL, queries []string) (err error) {
      
          ctx, cancel := context.WithCancel(ctx)
          defer cancel()
      
      
      Severity: Major
      Found in cloud/storage.go - About 40 mins to fix

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

        func (s *Storage) PrintFileBody(ctx context.Context, prefix *url.URL, query string, output io.Writer, header bool) error {
        Severity: Minor
        Found in cloud/storage.go - About 35 mins to fix

          TODO found
          Open

              // TODO: Delete or update this.
          Severity: Minor
          Found in cloud/storage.go by fixme

          There are no issues that match your filters.

          Category
          Status