Skip to content

Commit

Permalink
fix: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
snaselj committed Jan 25, 2024
1 parent 00a6442 commit e1990a6
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 202 deletions.
8 changes: 4 additions & 4 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[flake8]
# E501: Line length is enforced by Black, so flake8 doesn't need to check it
# W503: Black disagrees with this rule, as does PEP 8; Black wins
ignore = E501, W503
exclude =
ignore =
E501, # Line length is enforced by Black, so flake8 doesn't need to check it
W503 # Black disagrees with this rule, as does PEP 8; Black wins
exclude =
__pycache__,
.venv,
tests/inputs
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ about: Report a reproducible bug in the current release of pylint-nautobot
### Environment
* Python version: <!-- Example: 3.11.4 -->
* Nautobot version: <!-- Example: 2.0.0 -->
* pylint-nautobot version: <!-- Example: 2.0.1 -->
* pylint-nautobot version: <!-- Example: 1.0.0 -->

<!-- What did you expect to happen? -->
### Expected Behavior
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ about: Propose a new feature or enhancement

### Environment
* Nautobot version: <!-- Example: 2.0.0 -->
* pylint-nautobot version: <!-- Example: 2.0.1 -->
* pylint-nautobot version: <!-- Example: 1.0.0 -->

<!--
Describe in detail the new functionality you are proposing.
Expand Down
82 changes: 71 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
# Swap files
*.swp

# Vagrant
.vagrant
Vagrantfile

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -196,11 +192,48 @@ $RECYCLE.BIN/
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

.idea
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

Expand All @@ -213,12 +246,21 @@ out/
# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### PyCharm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

Expand All @@ -227,6 +269,28 @@ fabric.properties
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

### vscode ###
.vscode/*
*.code-workspace
Expand All @@ -239,10 +303,6 @@ development/*.txt
invoke.yml

# Docs
docs/README.md
docs/CHANGELOG.md
public

# Vagrant
.vagrant
Vagrantfile
/compose.yaml
/pylint-nautobot/static/nautobot_firewall_models/docs
1 change: 1 addition & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ rules:
quote-type: "double"
ignore: |
.venv/
compose.yaml
18 changes: 0 additions & 18 deletions development/creds.example.env

This file was deleted.

33 changes: 0 additions & 33 deletions development/development.env

This file was deleted.

3 changes: 0 additions & 3 deletions development/development_mysql.env

This file was deleted.

3 changes: 0 additions & 3 deletions development/docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ x-nautobot-build: &nautobot-build
dockerfile: "development/Dockerfile"
x-nautobot-base: &nautobot-base
image: "pylint-nautobot/nautobot:${NAUTOBOT_VER}-py${PYTHON_VER}"
env_file:
- "development.env"
- "creds.env"
tty: true

version: "3.8"
Expand Down
129 changes: 1 addition & 128 deletions development/nautobot_config.py
Original file line number Diff line number Diff line change
@@ -1,129 +1,2 @@
"""Nautobot development configuration file."""
import os
import sys

from nautobot.core.settings import * # noqa: F403 # pylint: disable=wildcard-import,unused-wildcard-import
from nautobot.core.settings_funcs import is_truthy, parse_redis_connection

#
# Debug
#

DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", False))
_TESTING = len(sys.argv) > 1 and sys.argv[1] == "test"

if DEBUG and not _TESTING:
DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": lambda _request: True}

if "debug_toolbar" not in INSTALLED_APPS: # noqa: F405
INSTALLED_APPS.append("debug_toolbar") # noqa: F405
if "debug_toolbar.middleware.DebugToolbarMiddleware" not in MIDDLEWARE: # noqa: F405
MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware") # noqa: F405

#
# Misc. settings
#

ALLOWED_HOSTS = os.getenv("NAUTOBOT_ALLOWED_HOSTS", "").split(" ")
SECRET_KEY = os.getenv("NAUTOBOT_SECRET_KEY", "")

#
# Database
#

nautobot_db_engine = os.getenv("NAUTOBOT_DB_ENGINE", "django.db.backends.postgresql")
default_db_settings = {
"django.db.backends.postgresql": {
"NAUTOBOT_DB_PORT": "5432",
},
"django.db.backends.mysql": {
"NAUTOBOT_DB_PORT": "3306",
},
}
DATABASES = {
"default": {
"NAME": os.getenv("NAUTOBOT_DB_NAME", "nautobot"), # Database name
"USER": os.getenv("NAUTOBOT_DB_USER", ""), # Database username
"PASSWORD": os.getenv("NAUTOBOT_DB_PASSWORD", ""), # Database password
"HOST": os.getenv("NAUTOBOT_DB_HOST", "localhost"), # Database server
"PORT": os.getenv(
"NAUTOBOT_DB_PORT", default_db_settings[nautobot_db_engine]["NAUTOBOT_DB_PORT"]
), # Database port, default to postgres
"CONN_MAX_AGE": int(os.getenv("NAUTOBOT_DB_TIMEOUT", 300)), # Database timeout
"ENGINE": nautobot_db_engine,
}
}

# Ensure proper Unicode handling for MySQL
if DATABASES["default"]["ENGINE"] == "django.db.backends.mysql":
DATABASES["default"]["OPTIONS"] = {"charset": "utf8mb4"}

#
# Redis
#

# The django-redis cache is used to establish concurrent locks using Redis.
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": parse_redis_connection(redis_database=0),
"TIMEOUT": 300,
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
},
}
}

#
# Celery settings are not defined here because they can be overloaded with
# environment variables. By default they use `CACHES["default"]["LOCATION"]`.
#

#
# Logging
#

LOG_LEVEL = "DEBUG" if DEBUG else "INFO"

# Verbose logging during normal development operation, but quiet logging during unit test execution
if not _TESTING:
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"normal": {
"format": "%(asctime)s.%(msecs)03d %(levelname)-7s %(name)s :\n %(message)s",
"datefmt": "%H:%M:%S",
},
"verbose": {
"format": "%(asctime)s.%(msecs)03d %(levelname)-7s %(name)-20s %(filename)-15s %(funcName)30s() :\n %(message)s",
"datefmt": "%H:%M:%S",
},
},
"handlers": {
"normal_console": {
"level": "INFO",
"class": "logging.StreamHandler",
"formatter": "normal",
},
"verbose_console": {
"level": "DEBUG",
"class": "logging.StreamHandler",
"formatter": "verbose",
},
},
"loggers": {
"django": {"handlers": ["normal_console"], "level": "INFO"},
"nautobot": {
"handlers": ["verbose_console" if DEBUG else "normal_console"],
"level": LOG_LEVEL,
},
},
}

#
# Apps
#

# Enable installed Apps. Add the name of each App to the list.
PLUGINS = []
SECRET_KEY = "NOTASECRET" # nosec

0 comments on commit e1990a6

Please sign in to comment.