<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pavlo </title>
    <description>The latest articles on DEV Community by Pavlo  (@plozovik).</description>
    <link>https://dev.to/plozovik</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F891267%2F1da77d6a-b77e-4a2d-9f2f-b22623358cd3.jpg</url>
      <title>DEV Community: Pavlo </title>
      <link>https://dev.to/plozovik</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/plozovik"/>
    <language>en</language>
    <item>
      <title>DDD — The Basics</title>
      <dc:creator>Pavlo </dc:creator>
      <pubDate>Sun, 24 Aug 2025 07:33:23 +0000</pubDate>
      <link>https://dev.to/plozovik/ddd-the-basics-52cp</link>
      <guid>https://dev.to/plozovik/ddd-the-basics-52cp</guid>
      <description>&lt;p&gt;This article covers the &lt;strong&gt;basic building blocks of a DDD (Domain Driven Design)&lt;/strong&gt; approach to create your applications and systems.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkoa9dmo072f224bneexb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkoa9dmo072f224bneexb.jpg" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Generally speaking, &lt;strong&gt;DDD&lt;/strong&gt; gives us a framework for a way of &lt;strong&gt;aligning business with technology&lt;/strong&gt; throughout the whole project lifecycle. It closes the gap between all project participants and knowledge domains in a way that allows to streamline the efforts more effectively.&lt;/p&gt;

&lt;h2&gt;
  
  
  Explore your domain
&lt;/h2&gt;

&lt;p&gt;Discovering and understanding your business domain is the first step. You’ll figure out which parts of your business your application will cover and what exactly differentiates your business from your competitors, so you can clearly understand where to put the most of the best resources.&lt;/p&gt;

&lt;p&gt;Create a discussion group of people who carry the business knowledge — such as stakeholders or domain experts — and technical people who will later translate it into technical languages.&lt;br&gt;
The discussion should give you a story about the business, whose outcome will be the first drafts of the &lt;strong&gt;ubiquitous language&lt;/strong&gt; and picture of organizational units, which then will turn into &lt;strong&gt;model(s)&lt;/strong&gt; grouped by &lt;strong&gt;Bounded Contexts&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;And very often, after such discussions business stakeholders start to understand their business even better than before.&lt;/em&gt;🙂&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ubiquitous Language&lt;/strong&gt; — the vocabulary to be used while speaking about the project and to name your packages/objects/relations or even microservices. Positive outcome — everyone will be on the same page of a project’s understanding and amount of confusions during imlementations will be avoided by design.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bounded Context&lt;/strong&gt; — cohesively grouped part of the business which shaped and modelled with it’s own concepts, terminology, rules and even dialects of a &lt;strong&gt;Ubiquitous Language&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Model&lt;/strong&gt; — a visual representation of a &lt;strong&gt;current state of a Bounded Context&lt;/strong&gt;, usually in a whiteboard format. Then you can express with UML or any other diagram style it’s parts for more clarity.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Be selective with details, otherwise you will not see the forest for the trees!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Model &amp;amp; Design
&lt;/h2&gt;

&lt;p&gt;When your first discussion is over and you already have plenty of textual notes and some visual sketches (without any technological aspects in mind!) — it’s perfect, because now you can start a &lt;strong&gt;strategical design&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Strategical design
&lt;/h3&gt;

&lt;p&gt;This is a &lt;strong&gt;macro-level&lt;/strong&gt; view of your project. Describes &lt;strong&gt;what&lt;/strong&gt; to create.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Distill the &lt;strong&gt;Ubiquitous Language&lt;/strong&gt; from your notes and create a glossary for your project — this is the core meanings which then will be represented in all of the next steps and must be always kept in synchronization throughout the whole further project’s lifecycle.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Align your draw-sketches with the &lt;strong&gt;Ubiquitous Language&lt;/strong&gt; so the visual representation telling the story about the business, its parts and relations between them in the same language, but just from the visual perspective — it will set the stage for further implementation steps. It will become the first version of your &lt;strong&gt;Model&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pay attention which parts of your business are:&lt;br&gt;
&lt;em&gt;core&lt;/em&gt; — what diffirintiates you in the market and where you need to put the most and the best of your resources available;&lt;br&gt;
&lt;em&gt;supporting subdomains&lt;/em&gt; — the ones which supporting the core;&lt;br&gt;
&lt;em&gt;generic subdomains&lt;/em&gt; — the ones which you can completely outsource.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cohesively group parts of your &lt;strong&gt;Model&lt;/strong&gt; visualization to form &lt;strong&gt;Bounded Contexts&lt;/strong&gt;. Each &lt;strong&gt;Bounded Context&lt;/strong&gt; will be represented through it’s own &lt;strong&gt;Model&lt;/strong&gt; which relations will be shaped in a &lt;strong&gt;Context Map&lt;/strong&gt;. &lt;strong&gt;Context Map&lt;/strong&gt; often acts as a “glue” between project management and developers teams. As a result, things will become more organized and this sets the stage for your next tactical steps.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Bounded Contexts &amp;amp; Context Map
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Let’s dive deeper into those 2 concepts.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After your first version of a business view is created (might be just a single model), you need to cohesively group them into a selectively organized (distilled) knowledge which aim to tell a certain story about this part of the business. Each of those groups called &lt;strong&gt;Bounded Context&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bounded Context&lt;/strong&gt; hiding not only implementation but also domain complexity from the other organizational boundaries, but sharing part of the contexts which is common for multiple organizational contexts. This “public aggregates” will later be mapped to connections between Services.&lt;/p&gt;

&lt;p&gt;As a result, your more organized &lt;strong&gt;Model&lt;/strong&gt; will become a &lt;strong&gt;Context Map&lt;/strong&gt;, which holds and explains relations between each &lt;strong&gt;Bounded Context&lt;/strong&gt;. And quality of this project phase will inevitably impact on quality of the &lt;strong&gt;tactical&lt;/strong&gt; steps which should be taken next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffl5p9bo3p63farv1a2v9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffl5p9bo3p63farv1a2v9.png" alt=" " width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tactical design
&lt;/h2&gt;

&lt;p&gt;This is a &lt;strong&gt;micro-level&lt;/strong&gt; view of your project. Describes &lt;strong&gt;how&lt;/strong&gt; to create.&lt;/p&gt;

&lt;p&gt;After everyone is aligned on the &lt;strong&gt;strategy&lt;/strong&gt;, we can zoom in to plan the implementation by bringing our &lt;strong&gt;strategic-level&lt;/strong&gt; knowledge to the more tech people to express it through technology.&lt;/p&gt;

&lt;p&gt;In Domain-Driven Design (DDD), there are several distinct concepts that holding specific meaning for the implementation part and helping all participants to communicate about what a piece of code (class/object/package/etc.) represents — the same goal as design patterns, but more DDD-driven.&lt;/p&gt;

&lt;h3&gt;
  
  
  Value Object
&lt;/h3&gt;

&lt;p&gt;The smallest consistent unit of knowledge of your business which is immutable, does not require any unique identity and lifecycle of an object.&lt;/p&gt;

&lt;p&gt;Example: &lt;code&gt;Money&lt;/code&gt; — amount, currency.&lt;/p&gt;

&lt;p&gt;⚠️Do not misinterpret that Value Object should be always small. It can be also a huge entity, but still immutable, without any unique identity and managed lifecycle.&lt;/p&gt;

&lt;h3&gt;
  
  
  Entity
&lt;/h3&gt;

&lt;p&gt;You can think of it as an “extended Value Object” with added “features” on top, like unique identity and preserved lifecycle of an instance.&lt;/p&gt;

&lt;p&gt;Example: &lt;code&gt;User&lt;/code&gt; — userId, name, email.&lt;/p&gt;

&lt;h3&gt;
  
  
  Aggregate
&lt;/h3&gt;

&lt;p&gt;You can think of it as a business-meaningful instance which has it’s own identity, state and lifecycle, composed of other &lt;strong&gt;Entities **and/or **Value Objects&lt;/strong&gt;, forming a cohesive cluster with &lt;em&gt;clear ownership&lt;/em&gt; and &lt;em&gt;boundaries&lt;/em&gt;. The cohesiveness is ensured by Aggregate’s rules invoked by it’s each invoked operation.&lt;/p&gt;

&lt;p&gt;ℹ️Each operation on Aggregate goes through a root Entity.&lt;/p&gt;

&lt;p&gt;ℹ️Aggregate takes care of a consistent state of it’s cluster — no transaction can break it’s business rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;ShoppingCart&lt;/code&gt; — refers to User, Books and allowed PaymentSystem for that user.&lt;br&gt;
&lt;strong&gt;Example (rules):&lt;/strong&gt; &lt;code&gt;Order&lt;/code&gt; — must have ≥1 order line; can use only certain payments depending on country.&lt;/p&gt;

&lt;p&gt;And that’s a &lt;a href="https://medium.com/ingeniouslysimple/aggregates-in-domain-driven-design-5aab3ef9901d" rel="noopener noreferrer"&gt;great another article&lt;/a&gt; specifically about Aggregates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Case
&lt;/h3&gt;

&lt;p&gt;Describes how the application meets a particular business goal.&lt;/p&gt;

&lt;p&gt;Operates on abovementioned Domain Concepts and never including details — everything is hidden behind abstractions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;AddBookToCart&lt;/code&gt; — Getting book + user inputs, calls aggregate transaction and calling analytics service to process the user behavior data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Service
&lt;/h3&gt;

&lt;p&gt;Stateless domain logic that doesn’t fit any existing Entity, Value Object or Aggregate. Often abstracts away a calls to some third-party service.&lt;/p&gt;

&lt;p&gt;Services can also come in different flavours, for details refer to this &lt;a href="https://stackoverflow.com/questions/2268699/domain-driven-design-domain-service-application-service/2279729#2279729" rel="noopener noreferrer"&gt;Stack Overflow answer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;PricingService&lt;/code&gt; — computes line totals/discounts/taxes for a cart.&lt;/p&gt;

&lt;h3&gt;
  
  
  Repository
&lt;/h3&gt;

&lt;p&gt;Encapsulates any transition logic to and from persistence data storage. Abstracts away persistence complexity with business-relevant APIs.&lt;/p&gt;

&lt;p&gt;Sometimes can be used to reconstitute an &lt;strong&gt;Entity&lt;/strong&gt; if it’s data is palced in multiple databases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;ShoppingCartRepository&lt;/code&gt; — findById, findOpenByUser, save.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Below is an example of how Ordering might be modelled in a flow chart and class diagrams.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6jujm02pmz6fxiscf3n9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6jujm02pmz6fxiscf3n9.png" alt=" " width="800" height="811"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This article presented only the core of &lt;strong&gt;DDD&lt;/strong&gt;. In real projects, it will be complemented by supportive approaches such as &lt;strong&gt;Clean Architecture&lt;/strong&gt; (I wrote about it in &lt;a href="https://medium.com/@plozovikov/clean-architecture-the-guide-you-need-dd8c179b9f95" rel="noopener noreferrer"&gt;my other article with a hands-on project example&lt;/a&gt;) or a bunch of other patterns.&lt;/p&gt;

&lt;p&gt;From my perspective, the main value DDD brings is the ability to view a project from multiple angles and to step into the shoes of different roles — both technical and non-technical. As a result, it gives you possibility to better forecast your decisions.&lt;/p&gt;

</description>
      <category>ddd</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Static Code Analysis - deep dive</title>
      <dc:creator>Pavlo </dc:creator>
      <pubDate>Sun, 12 May 2024 06:27:21 +0000</pubDate>
      <link>https://dev.to/plozovik/static-code-analysis-deep-dive-2790</link>
      <guid>https://dev.to/plozovik/static-code-analysis-deep-dive-2790</guid>
      <description>&lt;p&gt;Static Code Analysis. What is it about? Why and when is it important?&lt;/p&gt;

&lt;p&gt;What do you need to pay attention to before integrating Static Code Analysis (further — &lt;strong&gt;SCA&lt;/strong&gt;) tools into your workflow?&lt;/p&gt;

&lt;p&gt;And, most importantly, how does it contribute to the overall &lt;strong&gt;quality&lt;/strong&gt; culture in your team and your company?&lt;/p&gt;

&lt;p&gt;To cover these questions, we will walk together through the whole concept of quality, look into domains SCA can take care of, shortly dive into a real-life example that might happen in every organization and get familiar with nice (or even the best) SCA tools of different programming languages.&lt;/p&gt;

&lt;h2&gt;
  
  
  SCA and it’s role in the quality concept
&lt;/h2&gt;

&lt;p&gt;Before we start, we need to better familiarize with the broader aspect of a system’s quality, to have a clear definition and understand its parts to be able to define in which areas SCA lives.&lt;/p&gt;

&lt;p&gt;The quality of a system is a sum of its measurements describing to what extent the system is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maintainable;&lt;/li&gt;
&lt;li&gt;Reliable;&lt;/li&gt;
&lt;li&gt;Secure;&lt;/li&gt;
&lt;li&gt;Performant.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are the factors that determine how trustworthy, dependable, and resilient a software system is. Based on them, we can tailor the behavior and other characteristics of our system in the most optimal way to the environment where it operates.&lt;/p&gt;

&lt;p&gt;All of these measurements can be derived from different levels of a system quality analysis:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;Unit level&lt;/em&gt;&lt;/strong&gt; — single unit of code, like a function or class;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;Technology level&lt;/em&gt;&lt;/strong&gt; — integrated collection of units written in the same language;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;System level&lt;/em&gt;&lt;/strong&gt; — the whole technology stack + execution context in business reality to get a holistic view.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5730bge8r50r1n5ofhva.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5730bge8r50r1n5ofhva.png" alt="Microservices with SCA coverage areas" width="800" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everything aforementioned is covered by requirements: &lt;strong&gt;functional&lt;/strong&gt; and &lt;strong&gt;non-functional&lt;/strong&gt;, details of each depending on the environment where the system will operate.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When choosing tools for your project, understand it’s coverage level and search for ones which transcend the unit level scope.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Where SCA is contributing the most?
&lt;/h2&gt;

&lt;p&gt;Static code analysis is the process of examining your code without executing it to help you find and fix issues early in the development cycle. Usually, such SCA tools are restricted to the &lt;strong&gt;unit&lt;/strong&gt; and partially &lt;strong&gt;technology&lt;/strong&gt; levels. They are good for targeted “microscope” analysis but are quite weak when it comes to the integration level, especially with third-party tools or libraries.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fox269asf3h535j2eepi8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fox269asf3h535j2eepi8.png" alt="SCA contribution layers" width="763" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These tools capture unused variables, overcomplicated expressions, and similar items useful for the hygiene of the code. Lack of context prevents prioritizing those issues well, but they ensure a decent level of &lt;strong&gt;readability&lt;/strong&gt; and &lt;strong&gt;tidiness of the code&lt;/strong&gt;, which is important for its maintainability, and to some extent for code &lt;strong&gt;reliability&lt;/strong&gt; and &lt;strong&gt;performance efficiency&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits&lt;/strong&gt;: It provides a narrow-focused analysis that helps with niche technology problems; usually offers fast feedback to developers with low performance overhead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Downside&lt;/strong&gt;: It does not give us a holistic view of the whole system, including all of its integration behavior in its operational state.&lt;/p&gt;

&lt;p&gt;According to the &lt;a&gt;How to Deliver Resilient, Secure, Efficient, and Easily Changed IT Systems in Line with CISQ Recommendations&lt;/a&gt; paper, there is a strong imbalance between the amount of findings per certain quality level and their impact:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;92%&lt;/strong&gt; of the total errors are in the source code (&lt;strong&gt;Unit level&lt;/strong&gt;), but they account for only &lt;strong&gt;10%&lt;/strong&gt; of the defects in production.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;8%&lt;/strong&gt; of total defects reside at the &lt;strong&gt;Technology&lt;/strong&gt; and &lt;strong&gt;System levels&lt;/strong&gt; but lead to 90% of the serious reliability, security, and efficiency issues in production and consume over half the effort spent on fixing problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As we see, static code analysis falls into this first “unimportant” section. Does it mean we need to cut our attention here?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No, it does not. For two reasons:&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Technology Aspect
&lt;/h3&gt;

&lt;p&gt;Our systems should adhere to non-functional requirements defined by stakeholders, yet we still need to measure the internal structure of a software product: absence of hardcoded passwords/tokens in our code, elimination of dead unused variables, avoidance of overcomplicated expressions, and other factors contributing to the hygiene of the code. This is crucial for the project’s &lt;strong&gt;maintainability&lt;/strong&gt; and, to some extent, for its &lt;strong&gt;reliability&lt;/strong&gt;, &lt;strong&gt;security&lt;/strong&gt;, and &lt;strong&gt;performance efficiency&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Exposed code metrics assist executives in determining the risk that can be tolerated from each business or mission-critical system. This enables the setting of risk tolerance thresholds necessary to &lt;strong&gt;effectively allocate resources&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Human aspect
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;&lt;a href="https://en.wikipedia.org/wiki/Broken_windows_theory" rel="noopener noreferrer"&gt;Broken windows theory&lt;/a&gt;&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;In general, the theory states that visible signs of disorder incentivize criminals to make crimes because it signals that such a state is acceptable, the area is not monitored, and criminal behavior carries little risk of detection. In contrast, an ordered and clean environment, one that is maintained, signals that the area is monitored and that criminal behavior is not tolerated. The theory assumes that the &lt;strong&gt;landscape communicates to people&lt;/strong&gt;. It’s not the broken window itself that is defensive, but the message it sends to society.&lt;/p&gt;

&lt;p&gt;A successful strategy for preventing vandalism is to address the problems when they are small.&lt;/p&gt;

&lt;p&gt;And now, build the analogy to the software development lifecycle 😁&lt;/p&gt;

&lt;h4&gt;
  
  
  Normalization of deviance
&lt;/h4&gt;

&lt;p&gt;Normalization of deviance refers to a phenomenon when an organization tends to accept risky anomalies as normal through repeated success. When the system signals issues but they are not addressed immediately, cognitive bias starts building around the idea that this is not an issue at all. Over time, what was once considered deviant becomes normalized, potentially leading to dangerous or harmful consequences as individuals no longer recognize the risk involved. This concept is often observed in organizations where repeated deviations from safety procedures or standards gradually become an accepted practice.&lt;br&gt;
Also, over time, subsequent system parts are built on top of flawed components, making it difficult to implement easy fixes in the future.&lt;/p&gt;


&lt;h2&gt;
  
  
  No SCA in your toolchain
&lt;/h2&gt;

&lt;p&gt;Let’s go to a real-life disaster situation.&lt;/p&gt;

&lt;p&gt;Imagine you have a project written in Python with a codebase exceeding 10,000 lines, actively maintained by multiple developers. Initially, everyone agreed to use Python version 3.8 locally. However, there was little attention paid to the Python version installed on the virtual machines (VMs) where the code would be deployed. For convenience, Python 3.8 was installed everywhere, at least for the time being.&lt;/p&gt;

&lt;p&gt;Following a quality initiative forced in your company, it was decided that the latest Python 3.12 version should be used on all VMs (actually a very good decision). The upgrade was implemented, but soon issues started arising. Stack traces began appearing from your project installed on the VMs, caused by the backward incompatibility of Python features between your local 3.8 environment and the VMs’ 3.12 environment.&lt;/p&gt;

&lt;p&gt;In response to these failures, developers rushed to make quick fixes as the current issues are mission-critical for the business. Stack traces disappeared, but the quick-fixes unintentionally left some new bugs…&lt;/p&gt;

&lt;p&gt;Of course, such a situation is not normal and may never happen under adequate circumstances. To circumvent it, much better and more thought-through steps can be taken, but this is just an example 😉&lt;/p&gt;
&lt;h2&gt;
  
  
  Right SCA tools are integrated
&lt;/h2&gt;

&lt;p&gt;Now, let’s revisit the same situation, but this time our CI/CD pipeline has a properly-chosen and well-configured SCA integration.&lt;/p&gt;

&lt;p&gt;Sysadmins update the Python version on VMs, while developers add this Python version to the “python compatibility”-like field in the SCA tool. They then execute the pipeline to deliver the new artifact.&lt;/p&gt;

&lt;p&gt;The pipeline fails because it detects that some Python features used are incompatible with the desired 3.12 version, where they have been changed or even removed.&lt;/p&gt;

&lt;p&gt;Developers promptly address this issue at their normal pace. A new stable artifact version is then delivered to the VMs without any unexpected complications.&lt;/p&gt;


&lt;h2&gt;
  
  
  SCA coverage areas
&lt;/h2&gt;

&lt;p&gt;Before we dive into specifics of how SCA tools can effortlessly protect your company from potential disasters, it’s important to acknowledge that they are not a silver bullet. While they can significantly contribute to improving code quality and security, it’s essential to understand that &lt;strong&gt;&lt;em&gt;maintaining code quality requires constant ongoing effort&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Despite your effort and experience, it’s challenging to track all the “underwater rocks” that may be present in your code, especially if you’re working with projects written in different technologies. Even with decent knowledge of the programming language, there can still be hidden issues that are difficult to uncover without the assistance of tools like SCA.&lt;/p&gt;

&lt;p&gt;Indeed, all SCA tools are developed and continuously evolved by some of the best developers in their respective programming languages. To create algorithms that effectively detect flaws and issues, at least deep understanding of the technology is required. Therefore, feel free to treat integrated SCA tools into your pipeline like having a private high-class specialist working tirelessly for you, without weekends 😄&lt;/p&gt;



&lt;p&gt;All SCA tools can be divided into 2 groups: &lt;strong&gt;formatters&lt;/strong&gt; and &lt;strong&gt;linters&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Formatters
&lt;/h3&gt;

&lt;p&gt;Formatters are tools that addressing styling issues in code, without checking code logic.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As Guido van Rossum said, “Code is read much more often than it’s written.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Linters
&lt;/h3&gt;

&lt;p&gt;Linters are tools that aressing logical issues, like naming consistency and bug detection&lt;/p&gt;

&lt;p&gt;More specifically, each &lt;strong&gt;formatter&lt;/strong&gt; and &lt;strong&gt;linter&lt;/strong&gt; covers a specific domain of issues:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Formatters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code style;&lt;/li&gt;
&lt;li&gt;Code documentation style.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Linters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cognitive complexity;&lt;/li&gt;
&lt;li&gt;Code duplications;&lt;/li&gt;
&lt;li&gt;Unused code parts;&lt;/li&gt;
&lt;li&gt;Performance;&lt;/li&gt;
&lt;li&gt;Best practices;&lt;/li&gt;
&lt;li&gt;Security issues;&lt;/li&gt;
&lt;li&gt;Deprecations;&lt;/li&gt;
&lt;li&gt;and more 😉&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Code style &amp;lt;/&amp;gt;
&lt;/h3&gt;

&lt;p&gt;Code style is all about your code’s presentation. While inconsistent code style may not directly impact your application’s logic, it significantly affects the potential for your application to evolve effectively.&lt;/p&gt;

&lt;p&gt;Code is executed by machines but written for humans. When others read our code, we need to consider the cognitive load we impose on those people and how our changes will affect code review. Consistent code style dramatically reduces git diffs, making code reviews easier and more efficient. The harder the code review process, the fewer people can help you to identify potential flaws or improvements you can make.&lt;/p&gt;

&lt;p&gt;Our brains naturally grasp visual information by blocks, first seeing the bigger picture and only then focusing on details. The more we can keep our focus on the application’s logic and not on deciphering code content, the more effective our changes are.&lt;/p&gt;

&lt;p&gt;However, if our brains start fighting to understand the code style, which is different in different places for the same things, then reading of such code becomes trickier.&lt;/p&gt;

&lt;p&gt;Imagine a book where each sentence of a single chapter uses different fonts, space widths, colors, and is full of typos. Finishing reading the first page would already be an achievement, right?&lt;/p&gt;

&lt;p&gt;In our daily business, we primarily communicate through code. Having consistent style habits helps our brains relax and focus on important parts. It’s important to remember that that our communications are not only in present but also in future.&lt;/p&gt;
&lt;h3&gt;
  
  
  Code docu style📖
&lt;/h3&gt;

&lt;p&gt;Code documentation, especially for public APIs, is crucial. When a function or module has a proper text description, it allows other developers, as well as yourself in the future, to quickly understand the bigger picture and keep focus on the things you want to.&lt;/p&gt;

&lt;p&gt;The better you understand the code you are reading, the more effective your further decisions are, and the faster and more pleasant your development workflow becomes.&lt;/p&gt;

&lt;p&gt;Another role of our code documentation is auto-generating application documentation, often integrated into the application’s release cycle. Imagine, during automated release, one of the steps is generating a new HTML page on your beautiful company site for the new version of your application. To do such a thing, a third-party tool is always used, which expects inline documentation of a certain format that it can parse. No surprise if the code documentation format is broken, the third-party documentation generator will produce something else, or will even publish a broken HTML page. Is it good for your business reputation?&lt;/p&gt;

&lt;p&gt;Even if you don’t currently have documentation generation integration in place, having automated checks will help you be prepared for when such integration will be needed.&lt;/p&gt;
&lt;h3&gt;
  
  
  Cognitive complexity 𖡎
&lt;/h3&gt;

&lt;p&gt;We’ve already discussed the importance of reducing cognitive load in the code style section, emphasizing the need to lower the mental effort required to process information.&lt;/p&gt;

&lt;p&gt;However, cognitive complexity is often more inherent to application logic. While not all instances of cognitive complexity can be easily identified by static code analysis tools, some of them can. For further details and to avoid duplicating already well-articulated content, I recommend reading this article: &lt;a href="https://medium.com/@himanshuganglani/clean-code-cognitive-complexity-by-sonarqube-659d49a6837d" rel="noopener noreferrer"&gt;Clean Code: Cognitive Complexity by SonarQube&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Code duplications🔁
&lt;/h3&gt;

&lt;p&gt;Another enemy of code quality is code duplication. Each instance of code duplication increases the accidental complexity of your code.&lt;/p&gt;

&lt;p&gt;But what is &lt;strong&gt;accidental complexity&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;When writing software, our goal is to solve a business problem, which inherently has its own complexity, known as &lt;strong&gt;essential complexity&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;However, developers and software architects often add another type of complexity through the design and implementation of the software. This additional complexity is known as &lt;strong&gt;accidental complexity&lt;/strong&gt;, and while it’s inevitable, its amount should be minimized.&lt;/p&gt;

&lt;p&gt;Code duplication is the antithesis of this practice. It not only increases accidental complexity but also introduces risks during bug fixes: a developer may fix a bug in one duplicated code block but leave another untouched. The longer duplicated code is left in the codebase, the more instances of code duplication accumulate, increasing the risks to your application.&lt;/p&gt;

&lt;p&gt;Pay double attention to duplicated code by extracting it to a function or module, covering it with tests, and reusing it. This approach will establish the next “best practice” in your codebase, adhering to the principle of doing “one thing and doing it well” as outlined in the &lt;a href="http://www.catb.org/~esr/writings/taoup/html/ch01s06.html" rel="noopener noreferrer"&gt;Basics of the Unix Philosophy&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Unused code parts🗑️
&lt;/h3&gt;

&lt;p&gt;Just a list of why unused code is bad:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Needs maintenance, which wastes resources without giving value.&lt;/li&gt;
&lt;li&gt;Slows down performance by doing something which is not needed for adding business value, and sometimes, it’s a very huge performance-eating thing.&lt;/li&gt;
&lt;li&gt;Imposes cognitive complexity on your developers.&lt;/li&gt;
&lt;li&gt;Adds potential security breaches in your application.&lt;/li&gt;
&lt;li&gt;And now, one by one, real-life examples…&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of us have been in a situation where spending the next hour trying to understand and debug a piece of code, only to realize that it is doing nothing and is a leftover of prototyping/code refactoring/application decoupling or feature removal.&lt;/p&gt;

&lt;p&gt;Sometimes, such debugging scenarios are only possible in production environments, so such activities also impose security risks.&lt;/p&gt;

&lt;p&gt;Unused code still requires maintenance. Migration to a new platform or language version sometimes requires changes in the code itself. SCA tools like &lt;a href="https://www.sonarsource.com/products/sonarqube/" rel="noopener noreferrer"&gt;SonarQube&lt;/a&gt; findings require effort to fix bugs. Why do you need to spend this effort on code that is doing nothing?&lt;/p&gt;

&lt;p&gt;And here’s a big performance trouble situation: in my practice there was a noticeable performance breach caused by a heavyweight function leftover which was called hundreds of times and was identified in special cases at runtime, but unfortunately on the client’s side… It took a few days to find it, consumed many hours of clients’ time and our hotline to analyze the issue and trigger necessary conversations, but it would take just one pipeline execution for a static code analysis tool to find the breach and suggest a way to fix it.&lt;/p&gt;

&lt;p&gt;Maintain only code which is used. Maintenance is effort which should be considered as added value to your business.&lt;/p&gt;
&lt;h3&gt;
  
  
  Performance🚀
&lt;/h3&gt;

&lt;p&gt;Okay, we talked about performance in the context of unused code leftovers (a really special case, I agree), but now let’s take a look at more common scenarios.&lt;/p&gt;

&lt;p&gt;Such cases might involve operations on arrays or other simple operations, which sometimes can be done in a more performant way. Do not neglect such cases because at scale, even the smallest performance leak would be very visible.&lt;/p&gt;
&lt;h3&gt;
  
  
  Best practices🏅
&lt;/h3&gt;

&lt;p&gt;Every goal can be reached in different ways, but only a few of them are the ones you and your project need.&lt;/p&gt;

&lt;p&gt;Examples include shadowing variables, variable reassignment inside of functions, using inefficient methods, invoking risky APIs within code blocks, handling exceptions, or using APIs when better native alternatives exist, and so on. I can continue the list of examples, but the main point is that each change you make should keep “evolution doors” open, allowing for further refactoring or module decoupling while maintaining clarity of the change’s intention for other developers. SCA tools provide good assistance in achieving this.&lt;/p&gt;
&lt;h3&gt;
  
  
  Security🛡️
&lt;/h3&gt;

&lt;p&gt;Hardcoded passwords or tokens? Script injection risk? Overlooked outer scope variable overriding? Risky regular expressions? Those, and many other issues, are very easy to overlook even for experienced developers. Leaving them as-is, in the best-case scenario, will result in frustrated work in the future.&lt;/p&gt;

&lt;p&gt;Consider the security of your application as a must-have feature 😉&lt;/p&gt;
&lt;h3&gt;
  
  
  Deprecations❌
&lt;/h3&gt;

&lt;p&gt;Moving to a new language version may result in some of the APIs you’re using becoming deprecated. Not adapting to these changes before making the version jump can lead to troubles.&lt;/p&gt;

&lt;p&gt;The kind of trouble will vary depending on the language. Some languages will catch deprecated API usage at compile time, but in languages like JavaScript or Python, if the code is not covered by tests, deprecated APIs may slip into production, causing failures at runtime. If such a situation occurs, I hope the observability of your infrastructure allows you to catch it at an early stage, or you’re fortunate enough to realize it quickly and address all the consequences.&lt;/p&gt;
&lt;h2&gt;
  
  
  To use or not to use?
&lt;/h2&gt;

&lt;p&gt;And now, the question: should we apply static code analysis everywhere?&lt;br&gt;
It depends 😂&lt;/p&gt;

&lt;p&gt;It depends on many factors. For instance, if there is a simple Python script that only needs to copy some folders in the pipeline or be called on demand, there is no need to overdo things here. However, if there is a promising project that multiple teams rely on, then definitely yes, you need thorough SCA tools integration, for all the good reasons mentioned above.&lt;/p&gt;

&lt;p&gt;It also depends on the policies in your company. Blindly including static code analysis without agreed plans to fix found issues, when the results are integrated into quality reports, will only break your KPIs, and no one would be thankful for that.&lt;/p&gt;

&lt;p&gt;But again, if your team sees all the reasons why such tools should be integrated, you’d better do it as early as possible. &lt;br&gt;
&lt;em&gt;Now it will cost you time, but later it will cost you work.&lt;/em&gt;&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Let’s go to concrete examples!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you want to make research on your own, Analysis-Tools is a great resource for that! It has a list of, I think, most of the linters available on the market.&lt;/p&gt;

&lt;p&gt;But for now, let’s stick with concrete examples derived from my own practical experience. In my opinion, those tools represent the bare minimum for covering most of the topics discussed in this article in the most efficient and user-friendly manner.&lt;/p&gt;

&lt;p&gt;Tools listed below are more focused on the source code aspect rather than security, like for example Blackduck, simply because I have more experience with them at the moment. The topic of security is vast and opened for further articles 😎&lt;/p&gt;
&lt;h2&gt;
  
  
  Python
&lt;/h2&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://docs.astral.sh/ruff/" rel="noopener noreferrer"&gt;Ruff&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Ruff is just a revelation and all-in-one solution for both formatting and linting in Python.&lt;/p&gt;

&lt;p&gt;It handles code style (naming conventions, indents, etc.), enforces Python rules, automatically upgrades syntax for newer language versions, resolves deprecations, identifies dead code, locates TODOs, highlights security issues, promotes Python best practices such as exception handling, suggests performance improvements (sometimes yielding drastic results), ensures docstring conformity, and automates fixes in your code to minimize manual work. And doing it &lt;strong&gt;blazingly fast&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Yes, it boasts remarkable speed, &lt;em&gt;outperforming other tools by 10 to 200 times&lt;/em&gt; (&lt;a href="https://docs.astral.sh/ruff/" rel="noopener noreferrer"&gt;see on the main page&lt;/a&gt;), and covers the majority of Python rules. It &lt;a href="https://docs.astral.sh/ruff/settings/" rel="noopener noreferrer"&gt;seamlessly integrates&lt;/a&gt; 1-to-1 rules from numerous other tools like Pylint, isort, Bandit, Flake(all of them), Black, …&lt;/p&gt;
&lt;h4&gt;
  
  
  From my personal experience
&lt;/h4&gt;

&lt;p&gt;I have always used &lt;strong&gt;&lt;a href="https://pylint.readthedocs.io/en/stable/" rel="noopener noreferrer"&gt;Pylint&lt;/a&gt;&lt;/strong&gt; in my pipeline and local git hooks. Then, tried out Ruff, and this was outcome, running on few thousand lines codebase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pylint&lt;/strong&gt; found ~120 errors, very slow results showing… (about 7–10 seconds)&lt;br&gt;
&lt;strong&gt;Ruff&lt;/strong&gt; found ~471 errors, instantaneously fast. (about 1 second or less)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ruff&lt;/strong&gt; brought to light numerous issues, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Import problems;&lt;/li&gt;
&lt;li&gt;Bad practices in exception handling and naming conventions;&lt;/li&gt;
&lt;li&gt;Various deviations from PEP standards;&lt;/li&gt;
&lt;li&gt;Inefficient usage of ‘for’ loops;&lt;/li&gt;
&lt;li&gt;Inefficient usage of Python built-ins;&lt;/li&gt;
&lt;li&gt;Identified usageof deprecated features from older Python versions; along with recommended alternatives&lt;/li&gt;
&lt;li&gt;Unclear function APIs;&lt;/li&gt;
&lt;li&gt;Risky utilization of built-in functionality;&lt;/li&gt;
&lt;li&gt;Suggestions for improving complex code parts.&lt;/li&gt;
&lt;li&gt;For each finding, Ruff offers helpful fix suggestions accompanied by a rule number. You can reference the documentation to gain a comprehensive understanding, complete with code examples, of each issue.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For each finding, &lt;strong&gt;Ruff&lt;/strong&gt; offers helpful fix suggestions accompanied by a rule number. You can reference the documentation to gain a comprehensive understanding, complete with code examples, of each issue.&lt;/p&gt;

&lt;p&gt;Below is a &lt;strong&gt;Ruff&lt;/strong&gt; config I came to (&lt;a href="https://packaging.python.org/en/latest/guides/writing-pyproject-toml/" rel="noopener noreferrer"&gt;pyproject.toml&lt;/a&gt; format)and believe this is a good candidate to be a bare minimum in a Python project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[tool.ruff]
src = ["src"]
fix = true
show-fixes = true
output-format = "concise"
line-length = 170
# python standard indent type and width
indent-width = 4
# us
target-version = "py312"
include = ["*.py"]
# exclude the same files as in .gitignore
respect-gitignore = true  

[tool.ruff.lint]
select = [
    "A", # flake8-builtins. Check for python builtins being used as variables or parameters.
    "ARG", # flake8-unused-arguments. Checks for unused arguments.
    "ASYNC", # flake8-async
    "B", # flake8-bugbear. Finding likely bugs and design problems in your program.
    "BLE", # flake8-blind-except. Checks for blind exception catching.
    "C4", # flake8-comprehensions. Write better list/set/dict comprehensions.
    "D", # pydocstyle. Checking compliance with Python docstring conventions.
    "DTZ", # flake8-datetimez. Ban the usage of unsafe naive datetime class.
    "E", # pycodestyle. Python style guide checker - errors.
    "ERA", # eradicate. Finds commented out code.
    "EM", # flake8-errmsg. Improves your stacktraces.
    "F", # pyflakes. Checks Python source files for errors.
    "FLY", # flynt. Search for 'join' which can be replaced by f-strings.
    "FA", # flake8-future-annotations. Helps pyupgrade for better code autofixes.
    "FBT", # flake8-boolean-trap. Avoiding the confusing antipattern.
    "FURB", # refurb. A tool for refurbish and modernize Python codebases.
    "I", # isort. Helps you to see imports issues.
    "ISC", # flake8-implicit-str-concat. Helps for better strings concatenation.
    "ICN", # flake8-import-conventions. Improves your imports.
    "INP", # implicit-namespace-package. Checks for packages that are missing an __init__.py file.
    "UP", # pyupgrade. A tool to automatically upgrade syntax for newer versions.
    "LOG", # flake8-logging. Checks for issues using the standard library logging module.
    "PIE", # flake8-pie. Implements misc. lints.
    "PL", # pylint.
    "PTH", # flake8-use-pathlib. Pathlib provides an easier method to interact with the filesystem no matter what the operating system is.
    "PERF", # Perflint. Search for performance antipatterns.
    "RSE", # flake8-raise. Finds improvements for raise statements.
    "RET", # flake8-return. Finds improvements for return statements.
    "RUF", # Ruff-specific rules.
    "N", # pep-8 naming
    "S", # bandit. Automated security testing built right into your workflow!
    "SLF", # flake8-self. Cehcks for private members access.
    "SIM", # flake8_simplify. Cehcks for code that can be simplified.
    "T20", # flake8-print. Checks for 'print' and 'pprint'.
    "TID", # flake8-tidy-imports. Helps you write tidier imports.
    "TRY", # tryceratops. Helps you to improve try/except blocks.
    "TCH", # flake8-type-checking. Lets you know which imports to move in or out of type-checking blocks.
    "TD003", # flake8-todos. Check for TODO to have issue link.
    "W", # pycodestyle. Python style guide checker - warnings.
    "YTT", # flake8-2020. Checks for misuse of `sys.version` or `sys.version_info`.
]

ignore-init-module-imports = true
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]  

[tool.ruff.lint.isort]
force-single-line = true
order-by-type = false  

[tool.ruff.lint.pydocstyle]
convention = "pep257"  

[tool.ruff.format]
# Enable reformatting of code snippets in docstrings.
docstring-code-format = true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To effortlessly safe fix and format found issues:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ruff check --select I --fix
ruff format
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For non-safe fixes, which will require your own aftercheck, execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ruff check --fix --unsafe-fixes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;a href="https://mypy-lang.org/" rel="noopener noreferrer"&gt;MyPy&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Static type checking is crucial for promising Python projects that are evolving beyond simple scripting. To achieve this, you need more control over Python’s dynamic nature. By introducing stricter typing, you can anticipate future language updates without encountering runtime errors.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The more you annotate, the more effective &lt;strong&gt;MyPy&lt;/strong&gt; will be.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To help yourself and automatically annotate your code use one of &lt;a href="https://monkeytype.readthedocs.io/en/latest/index.html" rel="noopener noreferrer"&gt;MonkeyType&lt;/a&gt;, &lt;a href="https://github.com/JelleZijlstra/autotyping" rel="noopener noreferrer"&gt;autotyping&lt;/a&gt; and &lt;a href="https://github.com/dropbox/pyannotate" rel="noopener noreferrer"&gt;PyAnnotate&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;An excellent goal to aim for is to have your codebase pass with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mypy --strict
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;a href="https://github.com/google/yapf?tab=readme-ov-file" rel="noopener noreferrer"&gt;Yapf&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Another useful formatter which can format your code accordingly to your current codestyle. Useful to avoid formatting overhead in big proejcts.&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript &amp;amp; TypeScript
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://prettier.io/" rel="noopener noreferrer"&gt;Prettier&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Prettier&lt;/strong&gt; is a dedicated formatter to style out your code. You can also do it with linter, if such configuration is available, but better to avoid it and use dedicated &lt;strong&gt;Prettier&lt;/strong&gt; which has been designed for this goal. &lt;a href="https://typescript-eslint.io/troubleshooting/formatting/#formatters-vs-linters" rel="noopener noreferrer"&gt;More about it here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Prettier is pretty fast in formatting huge codebases and &lt;a href="https://prettier.io/docs/en/rationale#correctness" rel="noopener noreferrer"&gt;doing it in a secure way&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The first requirement of &lt;strong&gt;Prettier&lt;/strong&gt; is to output valid code that has the exact same behavior as before formatting.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Format everything
npx prettier . --write
// Check everything
npx prettier . --check
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some useful integrations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://prettier.io/docs/en/install#git-hooks" rel="noopener noreferrer"&gt;Git Hooks integration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://prettier.io/docs/en/precommit" rel="noopener noreferrer"&gt;pre-commit integration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://prettier.io/docs/en/editors#visual-studio-code" rel="noopener noreferrer"&gt;VSCode integration&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If using &lt;strong&gt;ESLint&lt;/strong&gt;, use &lt;a href="https://github.com/prettier/eslint-config-prettier" rel="noopener noreferrer"&gt;eslint-config-prettier&lt;/a&gt; to disable all ESLint formatting rules to not be in a conflict with &lt;strong&gt;Prettier&lt;/strong&gt;. Also mentioned &lt;a href="https://prettier.io/docs/en/install#eslint-and-other-linters" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://eslint.org/" rel="noopener noreferrer"&gt;ESLint&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;The most popular JavaScript linter.&lt;/p&gt;

&lt;p&gt;It helps you find and fix problems in your JavaScript code. Problems can be anything from potential runtime bugs, to not following best practices and styling issues (use &lt;a href="https://prettier.io/" rel="noopener noreferrer"&gt;Prettier&lt;/a&gt; for that!)&lt;/p&gt;

&lt;p&gt;Use &lt;a href="https://eslint.org/docs/latest/rules/" rel="noopener noreferrer"&gt;rules&lt;/a&gt; page to see the &lt;strong&gt;ESLint&lt;/strong&gt; checks.&lt;/p&gt;

&lt;p&gt;The configuration can be pretty vast, up to 1000 lines, so my advice is to &lt;em&gt;search for popular OpenSource JS projects&lt;/em&gt; and see how they implemented it.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://typescript-eslint.io/" rel="noopener noreferrer"&gt;typescript-eslint&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The same as &lt;strong&gt;ESLint&lt;/strong&gt;, but for the TypeScript.&lt;/p&gt;

&lt;p&gt;My preferred way is to use &lt;a href="https://typescript-eslint.io/getting-started/typed-linting/" rel="noopener noreferrer"&gt;linting + type information&lt;/a&gt; and &lt;a href="https://typescript-eslint.io/users/configs/#stylistic-type-checked" rel="noopener noreferrer"&gt;stylistic-type-checked&lt;/a&gt; rules.&lt;/p&gt;

&lt;p&gt;For more, apply to the &lt;a href="https://typescript-eslint.io/rules/" rel="noopener noreferrer"&gt;rules&lt;/a&gt; page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java
&lt;/h2&gt;

&lt;p&gt;Let’s start with &lt;strong&gt;formatters&lt;/strong&gt;. The most prominent ones are: &lt;a href="https://checkstyle.sourceforge.io/" rel="noopener noreferrer"&gt;Checkstyle&lt;/a&gt; and &lt;a href="https://github.com/diffplug/spotless" rel="noopener noreferrer"&gt;Spotless&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spotless&lt;/strong&gt; is a current choice for many companies and a target to migrate out from the Checkstyle because of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configuration is way easier&lt;/li&gt;
&lt;li&gt;Can format many languages which is very beneficial when java project has also xml, groovy, kotlin, json and markdown files.&lt;/li&gt;
&lt;li&gt;Can make stylefixes with 1 command through the whole project, which allwos for githooks integrations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Continuing with &lt;strong&gt;linters&lt;/strong&gt;, there would be a good list you can choose from.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://pmd.github.io/" rel="noopener noreferrer"&gt;PMD&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Checks miscellaneous java code flaws. Has CPD module to check for code duplications. Has both &lt;a href="https://docs.gradle.org/current/userguide/pmd_plugin.html" rel="noopener noreferrer"&gt;Gradle&lt;/a&gt; and &lt;a href="https://maven.apache.org/plugins/maven-pmd-plugin/" rel="noopener noreferrer"&gt;Maven&lt;/a&gt; integration. For details, apply to &lt;a href="https://docs.pmd-code.org/latest/pmd_rules_java.html" rel="noopener noreferrer"&gt;Java rules&lt;/a&gt; and &lt;a href="https://docs.pmd-code.org/latest/pmd_rules_kotlin.html" rel="noopener noreferrer"&gt;Kotlin rules&lt;/a&gt; docu.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://github.com/uber/NullAway" rel="noopener noreferrer"&gt;NullAway&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;NullAway alerts you about possible NPEs by leveraging &lt;em&gt;@Nullable&lt;/em&gt; annotations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Go
&lt;/h2&gt;

&lt;p&gt;Go is a beautiful programming language in a sence that strict code quality checks is in it’s DNA.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://golangci-lint.run/" rel="noopener noreferrer"&gt;golangci-lint&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;1-to-1 analogy of earlier discussed &lt;a href="https://docs.astral.sh/ruff/" rel="noopener noreferrer"&gt;Ruff&lt;/a&gt; for Python in a sense of combining together huge amount of linters alltogether in 1 tool.&lt;/p&gt;

&lt;p&gt;At the moment, Includes huge amount of linters (&lt;strong&gt;115&lt;/strong&gt; at the time of writing!!). To list all of them, first &lt;a href="https://golangci-lint.run/welcome/install/" rel="noopener noreferrer"&gt;install&lt;/a&gt; and then execute command below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;golangci-lint help linters
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Outputting to common formats such as &lt;em&gt;JSON&lt;/em&gt;, &lt;em&gt;JUnit&lt;/em&gt;, and &lt;em&gt;Checkstyle&lt;/em&gt; facilitates seamless integration with CI/CD reporting dashboards. Additionally, HTML output enhances convenient workflow for local Git actions. The tool also offers native integration with GitHub Actions.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://github.com/alexkohler/identypo" rel="noopener noreferrer"&gt;identypo&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Simply checks for misspellings in your code.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://github.com/qax-os/goreporter" rel="noopener noreferrer"&gt;goreporter&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Not a static code analysis tool, but rather a smart integration point. It runs desired linters and unit tests and generate beautiful HTML/json/text report for all of them!&lt;/p&gt;

&lt;p&gt;HTML can be also customized by your own templates.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://wgliang.github.io/pages/goreporter-report.html" rel="noopener noreferrer"&gt;Online example of HTML report.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My personal workflow for linters would be like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;golangci-lint run --fix
staticcheck -checks all ./...
identypo ./...
// and locally or for pipeline reports
goreporter -p ./.. -r ./reports/report.html -f html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Multi-language SCA tools
&lt;/h3&gt;

&lt;p&gt;There are also tools on the market which encapsulating all of the checks away from developer to have all-in-one. The most popular are undoubtedly &lt;a href="https://www.sonarsource.com/products/sonarqube/" rel="noopener noreferrer"&gt;SonarQube&lt;/a&gt;, &lt;a href="https://www.jetbrains.com/qodana/?medium=cpc&amp;amp;campaign=EMEA_en_PL_Qodana_Search_Competitors&amp;amp;term=sonarqube&amp;amp;content=688548916227&amp;amp;gad_source=1&amp;amp;gclid=CjwKCAjw3NyxBhBmEiwAyofDYdI0j_B4QvaAPq4qQzaJnslIm7eUlMTR0a4c3G8ACXmxDcg_nvZ4_xoC0HcQAvD_BwE" rel="noopener noreferrer"&gt;Quodana&lt;/a&gt; and &lt;a href="https://megalinter.io/latest/" rel="noopener noreferrer"&gt;MegaLinter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I would use them as a last resoirt in our pipelines, and first try to catch issues by more niche tools, starting with Git-Hooks, them more heavyweight checks in CI/CD pipeline, and only then applying multilanguage SCA tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;To summarize, static code analysis helps cover some of the quality aspects of your projects and makes it a part of your daily routine, which inevitably becomes a part of developer’s learning process. It certainly improves code review by elevating it to a new level, allowing developers to focus more on design aspects and not be overwhelmed by minor issues. Since none of us has a compiler in our heads, some problems can be really tricky to grasp on your own, so feel free to outsource it to some nice SCA tool 😉&lt;/p&gt;

&lt;p&gt;First thing which will be improved by SCA integration is &lt;strong&gt;maintainability&lt;/strong&gt;, which is crucial for successful evolution process.&lt;/p&gt;

&lt;p&gt;And it will definitely reduce amount of “what the fucks” in your projects, but some of them probably will still stay ;)&lt;/p&gt;

&lt;p&gt;But despite all the benefits, your quality journey only begins here. SCA tools, despite their versatility, cover only a small part of possible issues. Those tricky ones you will have to find on your own. None of the integrated SCA tools will restrict you from investing your own efforts into the quality of your projects. Make such investments consistently, rather than waiting for a big-bang “chances”. &lt;strong&gt;Make it a habit.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Real-life experience has taught me a lot, summarized well in the following:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Don’t cut corners on quality, otherwise quality will cut corners on you.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In any case, clients in production are always ready to assist you in this endeavor 😉&lt;/p&gt;

</description>
      <category>devops</category>
      <category>codequality</category>
      <category>productivity</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
