Passed
Pull Request — master (#2)
by Yang
01:44
created

Python.LORIS.ServerSite   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 37.21 %

Importance

Changes 0
Metric Value
wmc 1
eloc 19
dl 16
loc 43
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A ServerResponse() 0 2 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
import sys
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
import os
0 ignored issues
show
Unused Code introduced by
The import os seems to be unused.
Loading history...
3
import argparse
4
import getpass
5
import logging
6
7
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
8
9
10
11
def ServerResponse(InstitutionID, protocolName):
0 ignored issues
show
Coding Style Naming introduced by
The name ServerResponse does not conform to the function naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name InstitutionID does not conform to the argument naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name protocolName does not conform to the argument naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The argument protocolName seems to be unused.
Loading history...
Unused Code introduced by
The argument InstitutionID seems to be unused.
Loading history...
12
    logger = logging.getLogger('LORISServerResponse')
0 ignored issues
show
Unused Code introduced by
The variable logger seems to be unused.
Loading history...
13
14
    #Resolved protocolname to CNBPID pattern.
15
16
17
    #if "protocol"
18
19
20
21
22
23
24
25
26
27 View Code Duplication
if __name__ == '__main__':
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
28
29
    parser = argparse.ArgumentParser(description=__doc__)
0 ignored issues
show
Coding Style Naming introduced by
The name parser does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
30
    parser.add_argument('-u', '--user', dest='email', type=str, help='Username/Email used for login')
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (101/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
31
    parser.add_argument('-p', '--production', dest='production', action='store_true', help='Example of boolean arg')
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (116/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
32
    parser.add_argument('-o', '--option', dest='option', type=str, help='Example of str arg')
33
34
    parser.add_argument('file', metavar='file', type=str, help='Example of a positional argument')
35
36
    args = parser.parse_args()
0 ignored issues
show
Coding Style Naming introduced by
The name args does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
37
    logger.info('--------------')
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable logger does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'logger'
Loading history...
38
39
    # Never ask for a password in command-line. Manually ask for it here
40
    password = getpass.getpass()
0 ignored issues
show
Coding Style Naming introduced by
The name password does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
41
42
    logger.info('Hello World!')
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'logger'
Loading history...
43