cloud/azure/storage.go
Method StorageService.UploadWithMetadata
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
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)
Method StorageService.UploadWithMetadata
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
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)
- Read upRead up
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
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)
Avoid deeply nested control flow statements. Open
Open
if err != nil {
break
}
Method StorageService.UploadWithMetadata
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ctx context.Context, container, filename string, in io.Reader, props *storage.BlobProperties, metadata storage.BlobMetadata) (err error) {
Function NewStorageService
has 5 return statements (exceeds 4 allowed). Open
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)
}
TODO found Open
Open
// TODO: The following methods should support both roadie based URL and Azure based URL.
- Exclude checks