Passed
Push — develop ( 9e1b8b...5d0b21 )
by Dean
03:00
created

SyncStatePlex   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 61.53%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 5
c 2
b 1
f 0
dl 0
loc 23
ccs 8
cts 13
cp 0.6153
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __init__() 0 6 1
A flush() 0 7 2
A prime() 0 3 1
A load() 0 3 1
1 1
from plugin.modules.core.manager import ModuleManager
0 ignored issues
show
Bug introduced by
The name manager does not seem to exist in module plugin.modules.core.
Loading history...
Configuration introduced by
Unable to import 'plugin.modules.core.manager' (invalid syntax (<string>, line 38))

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
2
3 1
from plex_database.library import Library
0 ignored issues
show
Configuration introduced by
Unable to import 'plex_database.library' (invalid syntax (<string>, line 75))

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
4 1
import elapsed
5 1
import logging
6
7 1
log = logging.getLogger(__name__)
8
9
10 1
class SyncStatePlex(object):
11 1
    def __init__(self, state):
12 1
        self.state = state
13 1
        self.task = state.task
14
15
        # Initialize plex.database.py
16 1
        self.library = Library(ModuleManager['matcher'].database)
17
18 1
    def load(self):
0 ignored issues
show
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
19
        # Ensure matcher configuration is up to date
20
        ModuleManager['matcher'].configure()
21
22 1
    @elapsed.clock
23
    def prime(self):
0 ignored issues
show
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
24
        return ModuleManager['matcher'].prime(force=True)
25
26 1
    @elapsed.clock
27
    def flush(self):
0 ignored issues
show
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
28
        with elapsed.clock(SyncStatePlex, 'flush:matcher'):
29
            log.debug('Flushing matcher cache...')
30
31
            # Flush matcher cache to disk
32
            ModuleManager['matcher'].flush(force=True)
33