Questions tagged [code-formatting]
focuses on legibility and consistent look of code: lexical-level intelligibility is a basic element of coding-style
                60 questions
            
            
            
                -2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                123
            
            views
        
        
            
            
        Clean code: formatting rules, dependent functions, multiple calls [closed]
                    About formatting
Here are two scenarios in which the details of the formatting are described.
How should in the clean code way, this be formatted
Scenario 1: Dependent functions of dependent functions
...
                
            
       
        
            
                0
            
            votes
        
        
            
                4
            
            answers
        
        
            
                2k
            
            views
        
        
            
        How can I ensure same code formatting across IDE?
                    We are a small team contributing to our startup project, on a daily basis the code changes and multiple PR are raised daily. The general issue we face while reviewing these PRs is the code formatting ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                885
            
            views
        
        
            
        How to integrate a profiler in the least invasive way possible?
                    I am currently using tracy to profile a program I am writing. Tracy as a tool seems quite awesome, but it has one issue.
You need to markup your code when profiling. This has the negative consequence ...
                
            
       
        
            
                6
            
            votes
        
        
            
                6
            
            answers
        
        
            
                1k
            
            views
        
        
            
            
            
        Is there any way of applying a code formatter to a active codebase that doesn't lead to suffering?
                    Often one wants to apply a code-formatter, like Black, or JuliaFormatter to a existing code-base.
One where standards have tried to be followed but a few things might have slipped in.
Once you have ...
                
            
       
        
            
                1
            
            vote
        
        
            
                2
            
            answers
        
        
            
                3k
            
            views
        
        
            
            
            
        C# convention for empty constructor [closed]
                    I know an empty method without any good reason is a code smell, but it can be required for constructors.
What would be a good way to write an empty constructor among the following?
class A
{
    ...
                
            
       
        
            
                2
            
            votes
        
        
            
                4
            
            answers
        
        
            
                591
            
            views
        
        
            
            
        Does linting without auto-correction make sense?
                    In our Ruby on Rails projects we use a linter for our slim templates: slim-lint. It doesn't support any automatic fixes, not even the easiest ones. So I'd like to abandon it because I don't like to go ...
                
            
       
        
            
                -1
            
            votes
        
        
            
                2
            
            answers
        
        
            
                617
            
            views
        
        
            
            
        What arguments in favor of automatic, mandatory, uniform code formatting in a software project? [closed]
                    I am the manager of a small team of software engineers.
I am looking for arguments in favor of automatic, mandatory code formatting.
For me it is natural, it goes with the Quality Assurance process ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                2k
            
            views
        
        
            
            
        What Is the Best (Conventional) Way to Format Code for PyQt5
                    I was looking into PyQt5 for one of my side-projects and would really like to get to learn it better. However, I wasn't sure how to correctly format the code. I've seen tutorials do class definitions ...
                
            
       
        
            
                2
            
            votes
        
        
            
                2
            
            answers
        
        
            
                396
            
            views
        
        
            
            
        Where to put private computed properties?
                    In Clean code it's suggested that private helper functions should always exist directly below the function they're directly used within. Should I be doing this when using computed properties? It's the ...
                
            
       
        
            
                2
            
            votes
        
        
            
                2
            
            answers
        
        
            
                379
            
            views
        
        
            
            
            
        Highlighting importance of order when using short-circuited conditions
                    I was working on a piece of code when I noticed that an if statement could work or crash depending on the order used for the parts connected with and.
You can replicate the problem like this:
...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                476
            
            views
        
        
            
            
        Workflow for git / code formatting / commit hooks etc
                    Our team is growing, and with it, discontent with common coding standards being imposed on developers with alternate (strong, bordering on religious) views on what constitutes a good coding style.
...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                128
            
            views
        
        
            
        Making control flow explicit through printing instead of using comments?
                    I would have the opinion and good practices in script programming about using print statements to materialize the control flow (I usually use an anchor mark, then the name of the function just entered,...
                
            
       
        
            
                8
            
            votes
        
        
            
                12
            
            answers
        
        
            
                7k
            
            views
        
        
            
            
        How small should functions be?
                    I'm new at writing professional code (the bulk of my experience is with personal projects) so excuse me if this is trivial. When I write code I find myself being a little inconsistent with how much ...
                
            
       
        
            
                5
            
            votes
        
        
            
                7
            
            answers
        
        
            
                9k
            
            views
        
        
            
            
        Why should we not put end brackets on the same line? [closed]
                    When writing block code in languages like C++ and Java, people usually argue over whether brackets at the end of a line should have their own line.
if (condition) {
if (condition)
{
However, I have ...
                
            
       
        
            
                1
            
            vote
        
        
            
                0
            
            answers
        
        
            
                134
            
            views
        
        
            
        Alternative to reorder c++ tokens
                    Our organization is looking to standardize the way we use const T& and T const& and while we initially looked at clang-format  to solve the job, it doesn't reorder tokens so there is no way to ...
                
            
       
         
         
         
         
         
        