Giter Site home page Giter Site logo

Comments (4)

JanFeld avatar JanFeld commented on May 24, 2024

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.

guy-maurel avatar guy-maurel commented on May 24, 2024

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.

JanFeld avatar JanFeld commented on May 24, 2024

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.

pemessier avatar pemessier commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.