🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)
🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)

🔧 Programmierung 🕛 kürzlich 4 Min Lesezeit
0

Lab 6 : Adding Static Analysis tool to DocBot

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

For this week we were tasked have a static Analysis tool for our tool that we have developed, in my case DocBot also we had a requirement for adding a CONTRIBUTING.md file to our Repo.






Formatter



What is a formatter, this is an additional tool that we can use in our code to have our code look cleaner and pretterier, making it organized and better to read. To accomplish this task i have used The Ruff Formatter, the reason why i choose this is that i found its documentation and their website easy to understand and the installation was also pretty easy.



Some other reasons include, availability of extensions and more support or documentations of this tool is available online for a beginner to use it.






How to use Ruff Formatter



Well this is pretty simple first it's the installation of the tool itself:



pip install ruff



Then there is actually 3 commands that you can use to format the code which include:




CODE
ruff format                   # Format all files in the current directory.
ruff format path/to/code/ # Format all files in `path/to/code` (and any subdirectories).
ruff format path/to/file.py # Format a single file.







For Example :

Unformatted Code:




CODE
def my_function(x,y):return x+y

class MyClass:
def method_one(self):print("Hello, World!")
def method_two(self,x):if x>10:return True
return False






Formatted Code (after applying Ruff):




CODE
def my_function(x, y):
return x + y


class MyClass:
def method_one(self):
print("Hello, World!")

def method_two(self, x):
if x > 10:
return True
return False






In this small example we can see that how Ruff takes care of the Spacing, Line Breaks and Indentation.






Linter



So linter is a tool that helps analyze the code and gives or fixes the issue, which will improve code quality and helps users to find bugs. For my requirement i have used The Ruff Linter as Ruff offers both Formatter and Linter.






How to use Ruff Linter



First of is the installation it is same, it will get installed along with Formater.

pip install ruff



Well Ruff Linter offers 4 option to the user which are:




CODE
ruff check                  # Lint all files in the current directory.
ruff check --fix # Lint all files in the current directory, and fix any fixable errors.
ruff check --watch # Lint all files in the current directory, and re-lint on change.
ruff check path/to/code/ # Lint all files in `path/to/code` (and any subdirectories).







When i ran this in my code i had one issue which was picked up the tool:





The final setting.json file will look like:




CODE
{
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff"
}
}








  • editor.formatOnSave: Automatically formats the code when you save the file.


  • editor.codeActionsOnSave: Specifies actions to take on save


  • source.fixAll: Applies all possible fixes explicitly (like linting errors).


  • source.organizeImports: Organizes import statements explicitly.


  • editor.defaultFormatter: Sets charliermarsh.ruff as the default formatter for Python code.






Conclusion



Well, it was fun adding an CONTRIBUTING.md file to our Repo, which i felt like a basic requirement for every open source programme, i was happy to learn about that and Secondly automation, which was also a new knowledge for me and i understood its importance too. Finally all of the commits were squashed together and merged to main.



AJO GEORGE 01-11-2024

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
3 Quellen
GPT-6 Astra Release Today? OpenAI’s Next Major AI Model Is Almost Here
1 Quelle
Apple accuses OpenAI of destroying evidence as trade-secrets fight intensifies
1 Quelle
Major AI platforms go down in unprecedented simultaneous outage
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Lab 6 : Adding Static Analysis tool to DocBot

Thematisch verwandte Begriffe: Adding, Static, Analysis, tool · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...