Errors detected in .deepsource.toml
.
64
65
66@task
67def docs(ctx, regenerate_config=False, push=False):68 """Pull and push translations to Transifex for our docs"""
69 with ctx.cd(os.path.join(ROOT_PATH, 'docs')):
70 # Update our tanslations
113
114 def get_blocks(self, obj):
115 """Combine and sort inner results (domains and sections)."""
116 serializers = {117 'domain': DomainSearchSerializer,
118 'section': SectionSearchSerializer,
119 }
94 except RuntimeError:
95 pass
96
97 def configure_mock(self, mock, kwargs): 98 """Configure object mocks."""
99 self.mocks[mock].configure_mock(**kwargs)
100
107 # have an impact when the project has lot of tags)
108 for version_obj in version_list.iterator():
109 version_slug = version_obj.verbose_name
110 comparable_version = parse_version_failsafe(version_slug)111 if comparable_version:
112 versions.append((version_obj, comparable_version))
113
73 else:
74 print('Cached top_lang: %s' % top_lang)
75 if top_lang in PL_DICT:
76 slug = PL_DICT[top_lang]77 print('Setting {} to {}'.format(repo_url, slug))
78 Project.objects.filter(
79 pk=project.pk,
The local variable name hides the variable defined in the outer scope, making it inaccessible and might confuse.
filename = 'myfile.txt'
def read_file(filename): # This shadows the global `filename`
with open(filename) as file:
return file.readlines()
FILENAME = 'myfile.txt' # renamed global to UPPER_CASE as convention
def read_file(filename):
with open(filename) as file:
return file.readlines()
Another usual suspect of this is when you use the same parameter name inside a function as the global variable you are using. For example:
def run_app(app):
# This `app` shadows the global app...
app.run()
if __name__ == '__main__':
app = MyApp() # This is a global variable!
run_app(app)
To avoid this re-defining of a global, consider not defining app
as a global, but inside a main()
function instead:
def run_app(app):
# There is no longer a global `app` variable.
app.run()
def main():
app = MyApp()
run_app(app)
if __name__ == '__main__':
main()