Eric-Guo/wechat

View on GitHub
lib/wechat/concern/qcloud.rb

Summary

Maintainability
A
45 mins
Test Coverage
F
42%

Method tcb_do_upload_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def tcb_do_upload_file(q_path, upload_url, signature, x_cos_security_token, x_cos_meta_fileid, file)
Severity: Minor
Found in lib/wechat/concern/qcloud.rb - About 45 mins to fix

    Redundant curly braces around a hash parameter.
    Open

            form_data = HTTP::FormData.create({ key: q_path,
                                                Signature: signature,
                                                'x-cos-security-token': x_cos_security_token,
                                                'x-cos-meta-fileid': x_cos_meta_fileid,
                                                file: form_file })
    Severity: Minor
    Found in lib/wechat/concern/qcloud.rb by rubocop

    This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

    Example: EnforcedStyle: braces

    # The `braces` style enforces braces around all method
    # parameters that are hashes.
    
    # bad
    some_method(x, y, a: 1, b: 2)
    
    # good
    some_method(x, y, {a: 1, b: 2})

    Example: EnforcedStyle: no_braces (default)

    # The `no_braces` style checks that the last parameter doesn't
    # have braces around it.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    
    # good
    some_method(x, y, a: 1, b: 2)

    Example: EnforcedStyle: context_dependent

    # The `context_dependent` style checks that the last parameter
    # doesn't have braces around it, but requires braces if the
    # second to last parameter is also a hash literal.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)
    
    # good
    some_method(x, y, a: 1, b: 2)
    some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

    There are no issues that match your filters.

    Category
    Status