Open Bug 1405914 Opened 7 years ago Updated 2 years ago

clang-format: Bad restyle of a struct literal

Categories

(Developer Infrastructure :: Lint and Formatting, defect, P3)

Tracking

(firefox58 affected)

Tracking Status
firefox58 --- affected

People

(Reporter: n.nethercote, Unassigned)

References

Details

clang-format just did this:

> -static const mozilla::Module kPrefModule = {
> -  mozilla::Module::kVersion,
> -  kPrefCIDs,
> -  kPrefContracts,
> -  nullptr,
> -  nullptr,
> -  nullptr,
> -  UnloadPrefsModule
> -};
> +static const mozilla::Module kPrefModule = { mozilla::Module::kVersion,
> +                                             kPrefCIDs,
> +                                             kPrefContracts,
> +                                             nullptr,
> +                                             nullptr,
> +                                             nullptr,
> +                                             UnloadPrefsModule };

Pretty gross. It would be nice if that could be avoided.
Priority: -- → P3
This is the expected behavior since we use flag |BAS_Align| that according to the clang-format documentation:

>>    /// \brief Align parameters on the open bracket, e.g.:
>>    /// \code
>>    ///   someLongFunction(argument1,
>>    ///                    argument2);
>>    /// \endcode
>>    BAS_Align, 

Also I've looked other our coding style page to see why we use that flag and It seems the explanation can be found here: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Methods

However I didn't find where the behavior that you mention is documented, and I don't think that implementing such a patch would be accepted up-stream since it envelopes treating a very particular scenario that doesn't have a wider application.
Product: Core → Firefox Build System
Blocks: clang-format
Component: Source Code Analysis → Lint and Formatting
Product: Firefox Build System → Developer Infrastructure
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.