GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#22)
by
unknown
01:09
created

qtsass.importers   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 50
rs 10
c 0
b 0
f 0
wmc 6

1 Function

Rating   Name   Duplication   Size   Complexity  
B qss_importer() 0 31 6
1
# -*- coding: utf-8 -*-
2
# -----------------------------------------------------------------------------
3
# Copyright (c) 2015 Yann Lanthony
4
# Copyright (c) 2017-2018 Spyder Project Contributors
5
#
6
# Licensed under the terms of the MIT License
7
# (See LICENSE.txt for details)
8
# -----------------------------------------------------------------------------
9
"""Libsass importers."""
10
11
# Standard library imports
12
from __future__ import absolute_import
13
import os
14
15
# Local imports
16
from qtsass.conformers import scss_conform
17
18
19
def qss_importer(where):
20
    """
21
    Returns a function which conforms imported qss files to valid scss to be
22
    used as an importer for sass.compile.
23
24
    :param where: Directory containing scss, css, and sass files
25
    """
26
27
    def find_file(import_file):
0 ignored issues
show
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...
28
29
        if os.path.isfile(import_file):
30
            return import_file
31
        extensions = ['.scss', '.css', '.sass']
32
        for ext in extensions:
33
            potential_file = import_file + ext
34
            if os.path.isfile(potential_file):
35
                return potential_file
36
            potential_file = os.path.join(where, import_file + ext)
37
            if os.path.isfile(potential_file):
38
                return potential_file
39
        return import_file
40
41
    def import_and_conform_file(import_file):
0 ignored issues
show
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...
42
43
        real_import_file = find_file(import_file)
44
        with open(real_import_file, 'r') as f:
0 ignored issues
show
Coding Style Naming introduced by
The name f does not conform to the variable 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...
45
            import_str = f.read()
46
47
        return [(import_file, scss_conform(import_str))]
48
49
    return import_and_conform_file
50