Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the code follow the new code guidelines. #2192

Closed
sledgehammer999 opened this issue Nov 22, 2014 · 10 comments
Closed

Make the code follow the new code guidelines. #2192

sledgehammer999 opened this issue Nov 22, 2014 · 10 comments
Labels
Milestone

Comments

@sledgehammer999
Copy link
Member

See #2091
And https://github.com/qbittorrent/qBittorrent/blob/master/CODING_GUIDELINES.md

This is tracking bug.
One suggestion is: Let's say you want to make a bug fix to main.cpp. You should first convert that file to use 4 spaces as indentation. Make a commit with the message Follow project coding style. Issue #2192.. Then do the bug fixing and make a new commit.

Hint: If you set in Qt Creator as indentation 4 spaces. Then all you have to do is to select all the code in a particular file->right click->auto-indent.
Hint2: You can also use a tool called uncrustify. Here is the last working config(not complete): https://github.com/qbittorrent/qBittorrent/blob/master/uncrustify.cfg

@sledgehammer999
Copy link
Member Author

@pmzqla, I think you said you used uncrustify. Can you share your working configuration here for others to have easy access to?

@pmzqla
Copy link
Contributor

pmzqla commented Nov 23, 2014

Here it is.

It's not complete, I have added options whenever I noticed something wasn't following the guidelines, but it's a good start.

@sledgehammer999
Copy link
Member Author

+1

@sledgehammer999
Copy link
Member Author

I added some new rules and I deleted one.
Here is an updated config file: https://gist.github.com/sledgehammer999/1cb1d9224d7fec8fa632
uncrustify configuration docs: https://github.com/bengardner/uncrustify/blob/master/documentation/htdocs/config.txt

Anyone using it, should use a commit message of Follow project coding style. Issue #2192. instead.

@sledgehammer999
Copy link
Member Author

Here is Qt Creator config file posted by @Gelmir in this comment

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorCodeStyle>
<!-- Written by QtCreator 3.2.82, 2014-11-26T02:08:28. -->
<qtcreator>
 <data>
  <variable>CodeStyleData</variable>
  <valuemap type="QVariantMap">
   <value type="bool" key="AlignAssignments">true</value>
   <value type="bool" key="AutoSpacesForTabs">false</value>
   <value type="bool" key="BindStarToIdentifier">false</value>
   <value type="bool" key="BindStarToLeftSpecifier">true</value>
   <value type="bool" key="BindStarToRightSpecifier">false</value>
   <value type="bool" key="BindStarToTypeName">true</value>
   <value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">false</value>
   <value type="bool" key="IndentAccessSpecifiers">false</value>
   <value type="bool" key="IndentBlockBody">true</value>
   <value type="bool" key="IndentBlockBraces">false</value>
   <value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
   <value type="bool" key="IndentClassBraces">false</value>
   <value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
   <value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
   <value type="bool" key="IndentEnumBraces">false</value>
   <value type="bool" key="IndentFunctionBody">true</value>
   <value type="bool" key="IndentFunctionBraces">false</value>
   <value type="bool" key="IndentNamespaceBody">true</value>
   <value type="bool" key="IndentNamespaceBraces">false</value>
   <value type="int" key="IndentSize">4</value>
   <value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
   <value type="bool" key="IndentSwitchLabels">false</value>
   <value type="int" key="PaddingMode">1</value>
   <value type="bool" key="SpacesForTabs">true</value>
   <value type="int" key="TabSize">4</value>
  </valuemap>
 </data>
 <data>
  <variable>DisplayName</variable>
  <value type="QString">qBittorrent</value>
 </data>
</qtcreator>

Gelmir added a commit to Gelmir/qBittorrent that referenced this issue Nov 29, 2014
@sledgehammer999
Copy link
Member Author

@sledgehammer999
Copy link
Member Author

Update uncrustify config file: https://gist.github.com/sledgehammer999/1cb1d9224d7fec8fa632

pmzqla added a commit to pmzqla/qBittorrent that referenced this issue Dec 7, 2014
buinsky added a commit to buinsky/qBittorrent that referenced this issue Dec 7, 2014
buinsky added a commit to buinsky/qBittorrent that referenced this issue Dec 7, 2014
magao added a commit to magao/qBittorrent that referenced this issue Feb 5, 2017
magao added a commit to magao/qBittorrent that referenced this issue Feb 5, 2017
magao added a commit to magao/qBittorrent that referenced this issue Feb 7, 2017
magao added a commit to magao/qBittorrent that referenced this issue Feb 8, 2017
magao added a commit to magao/qBittorrent that referenced this issue Feb 12, 2017
sledgehammer999 pushed a commit that referenced this issue Mar 4, 2017
sledgehammer999 pushed a commit that referenced this issue Mar 4, 2017
silverqx added a commit to silverqx/qBittorrent that referenced this issue Sep 24, 2017
sledgehammer999 pushed a commit that referenced this issue Oct 23, 2017
@thalieht
Copy link
Contributor

I think this can be closed now.

@qbittorrent qbittorrent locked and limited conversation to collaborators Feb 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants