Comments (4)
I maybe have a similar issue related to this with multiple consecutive parentheses/calls.
I'm using cxxopts
for command line option parsing.
The syntax for adding/defining options is like this:
int main(int argc, char** argv)
{
// ...
cxxopts::Options options{argv[0], "Description"};
options.add_options()
("a,optionA", "Option A Help Description")
("b,optionB", "Option B Help Description")
("c,optionC", "Option C Help Description")
("d,optionD", "Option D Help Description");
// ...
}
When using uncrustify it will be formatted like this even though i'd like to have it formatted like above:
int main(int argc, char** argv)
{
// ...
cxxopts::Options options{argv[0], "Description"};
options.add_options()
("a,optionA", "Option A Help Description")
("b,optionB", "Option B Help Description")
("c,optionC", "Option C Help Description")
("d,optionD", "Option D Help Description");
// ...
}
I didn't find any option for consecutive parentheses and their indentation.
Maybe this is related, if not i'm sorry.
It can be my configuration though, even if i don't know which one it could be.
Version: Uncrustify-0.78.1-82-e5d093335
Cheers,
Jan
from uncrustify.
Sorry, I cannot reproduce.
Using the cfg-file:
indent_columns = 4
indent_with_tabs = 0
with the command:
uncrustify -v
uncrustify -c pemessier.cfg -f pemessier.cpp
I get:
Uncrustify_d-0.78.1-92-8f96659fe-dirty
and the output file has no change.
I run under Linux.
Why the difference?
from uncrustify.
When running uncrustify with the snippet from @pemessier i get another different result:
int CPtCloudDataSWL::ASCIIReadNbPts(const size_t nbPtsToRead_)
{
const CTUnitDird normal(m_euler.TransformationMatrixGet()(0, 2),
m_euler.TransformationMatrixGet()(1, 2),
m_euler.TransformationMatrixGet()(2, 2));
const size_t nbPtsAdded = m_pts.size() - nbPtsToRead_; // see this additional indentation
m_ptNormals.insert(m_ptNormals.end(), nbPtsAdded, CTDirToF(normal)); // and this one ..
return 1;
}
I'm using tabs only and with the parameters you mentioned like the following:
indent_columns = 8
indent_with_tabs = 2
On Linux, version Uncrustify-0.78.1-82-e5d093335
.
My configuration file:
uncrustify.txt
from uncrustify.
int CPtCloudDataSWL::ASCIIReadNbPts( const size_t nbPtsToRead_ )
{
const CTUnitDird normal( m_euler.TransformationMatrixGet()( 0, 2 ),
m_euler.TransformationMatrixGet()( 1, 2 ),
m_euler.TransformationMatrixGet()( 2, 2 ) );const size_t nbPtsAdded = m_pts.size() - nbPtsToRead_; m_ptNormals.insert( m_ptNormals.end(), nbPtsAdded, CTDirToF( normal ) ); return 1;
}
Sorry my initial example was bad. This is the expected (no change) output that can be used as input:
int CPtCloudDataSWL::ASCIIReadNbPts( const size_t nbPtsToRead_ )
{
const CTUnitDird normal( m_euler.TransformationMatrixGet()( 0, 2 ),
m_euler.TransformationMatrixGet()( 1, 2 ),
m_euler.TransformationMatrixGet()( 2, 2 ) );
const size_t nbPtsAdded = m_pts.size() - nbPtsToRead_;
m_ptNormals.insert( m_ptNormals.end(), nbPtsAdded, CTDirToF( normal ) );
return 1;
}
The assignment lines are left-indented by 4 spaces.
On Windows, running uncrustify.exe -c - pemessier.cpp
produces the incorrect result;
int CPtCloudDataSWL::ASCIIReadNbPts( const size_t nbPtsToRead_ )
{
const CTUnitDird normal( m_euler.TransformationMatrixGet()( 0, 2 ),
m_euler.TransformationMatrixGet()( 1, 2 ),
m_euler.TransformationMatrixGet()( 2, 2 ) );
const size_t nbPtsAdded = m_pts.size() - nbPtsToRead_;
m_ptNormals.insert( m_ptNormals.end(), nbPtsAdded, CTDirToF( normal ) );
return 1;
}
from uncrustify.
Related Issues (20)
- Lambda in class constructor breaks comma rule with brace initialization HOT 3
- Infinite loop while parsing template with deprecation warning HOT 1
- Error with sp_return sp_case_label and sp_after_type when set to not_defined HOT 3
- Template move constructor parameter is seen as boolean operator HOT 3
- Wildcard fails to load files: Failed to load (*.cpp) HOT 1
- --tracking cannot be used with a file including a colon HOT 1
- Empty function call gets split despite using nl_func_call_empty
- Unexpected addition of a space between operator and sign
- Infinite loop - nested if statements (without braces) with a single line comment after a return. HOT 3
- Predictable temporary file name TOCTOU HOT 1
- the option sp_balance_nested_parens doesn't work if the value is "false"
- Uncrustify fails in multiline macro and respond without corresponding #if in `.h` file.
- Uncrustify hangs until the system runs out of memory HOT 3
- Mode for fixing/linting preprocessor comments only.
- Pointer return type appears to be treated as sp_arith for the first method after an access specifier
- cmt_convert_tab_to_spaces indents comments with spaces instead of configured tabs
- preprocessor #warning gets space inserted
- Ampersand reference appears to be treated as sp_arith after a cast to a custom type
- the test 60019 must be solved HOT 1
- align_assign_decl_func=0 is not working as expected
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uncrustify.