jkawamoto/roadie

View on GitHub
cloud/azure/storage.go

Summary

Maintainability
B
5 hrs
Test Coverage

Method StorageService.UploadWithMetadata has 81 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (s *StorageService) UploadWithMetadata(
    ctx context.Context, container, filename string, in io.Reader, props *storage.BlobProperties, metadata storage.BlobMetadata) (err error) {

    // Check the target container exists.
    containerRef := s.Client.GetContainerReference(container)
Severity: Major
Found in cloud/azure/storage.go - About 2 hrs to fix

    Method StorageService.UploadWithMetadata has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *StorageService) UploadWithMetadata(
        ctx context.Context, container, filename string, in io.Reader, props *storage.BlobProperties, metadata storage.BlobMetadata) (err error) {
    
        // Check the target container exists.
        containerRef := s.Client.GetContainerReference(container)
    Severity: Minor
    Found in cloud/azure/storage.go - 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 StorageService.UploadWithMetadata has 7 return statements (exceeds 4 allowed).
    Open

    func (s *StorageService) UploadWithMetadata(
        ctx context.Context, container, filename string, in io.Reader, props *storage.BlobProperties, metadata storage.BlobMetadata) (err error) {
    
        // Check the target container exists.
        containerRef := s.Client.GetContainerReference(container)
    Severity: Major
    Found in cloud/azure/storage.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if err != nil {
                      break
                  }
      Severity: Major
      Found in cloud/azure/storage.go - About 45 mins to fix

        Method StorageService.UploadWithMetadata has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            ctx context.Context, container, filename string, in io.Reader, props *storage.BlobProperties, metadata storage.BlobMetadata) (err error) {
        Severity: Minor
        Found in cloud/azure/storage.go - About 35 mins to fix

          Function NewStorageService has 5 return statements (exceeds 4 allowed).
          Open

          func NewStorageService(ctx context.Context, cfg *Config, logger *log.Logger) (s *StorageService, err error) {
          
              if logger == nil {
                  logger = log.New(ioutil.Discard, "", log.LstdFlags)
              }
          Severity: Major
          Found in cloud/azure/storage.go - About 35 mins to fix

            TODO found
            Open

            // TODO: The following methods should support both roadie based URL and Azure based URL.
            Severity: Minor
            Found in cloud/azure/storage.go by fixme

            There are no issues that match your filters.

            Category
            Status