Commit graph

36 commits

Author SHA1 Message Date
Andreas Sandberg
267443fa22 style: Fix incorrect style checker option name
The style used to support the option -w to automatically fix white
space issues. However, this option was actually wired up to fix all
styles issues the checker encountered. This changeset cleans up the
code that handles automatic fixing and adds an option to fix all
issues, and separate options for white spaces and include ordering.
2015-02-11 10:23:33 -05:00
Andreas Sandberg
9aad5b4569 style: Update the style checker to handle new include order
As of August 2014, the gem5 style guide mandates that a source file's
primary header is included first in that source file. This helps to
ensure that the header file does not depend on include file ordering
and avoids surprises down the road when someone tries to reuse code.

In the new order, include files are grouped into the following blocks:
  * Primary header file (e.g., foo.hh for foo.cc)
  * Python headers
  * C system/stdlib includes
  * C++ stdlib includes
  * Include files in the gem5 source tree

Just like before, include files within a block are required to be
sorted in alphabetical order.

This changeset updates the style checker to enforce the new order.
2015-02-03 14:25:50 -05:00
Andreas Sandberg
2e17d83629 style: Add support for a style ignore list and ignore ext/
There are some directories within the repository where we don't want
to enforce our coding style. Specifically, we don't want the style
hooks to warn whenever we update external code in the ext/ directory.
2014-08-26 10:14:30 -04:00
Andreas Sandberg
35bc5210d3 style: Fixup strange semantics in hg m5style
The 'hg m5style' command had some rather strange semantics. When
called without arguments, it applied the style checker to all added
files and modified regions of modified files. However, when providing
a list of files, it used that list as an ignore list instead of
specifically checking those files.

This patch makes the m5style command behave more like other Mercurial
commands where the arguments are used to specify which files to work
on instead of which files to ignore.
2014-08-26 10:14:07 -04:00
Joel Hestness
4a98b0cd59 Util: Do not style check symlinks
The style checker used to traverse symlinks if they pointed to files, which can
result in style checker failure if the pointed-to file doesn't exist. This
style check is actually unnecessary, since symlinks either point to other files
that are already style checked, or files outside gem5, which shouldn't be
checked. Skip symlinks.
2014-06-09 22:01:18 -05:00
Nathanael Premillieu
fe2faa1975 util: Fix issues with style checker. 2012-07-27 16:08:05 -04:00
Matt Evans
234fd1c4d8 Style: Make style.py's invalid warning print which file caused the infraction. 2012-06-29 11:19:06 -04:00
Steve Reinhardt
ed61e02b24 style.py: don't die on empty files 2011-09-24 08:12:26 -07:00
Nathan Binkert
1c23bc100f style: Make the style hook work in directories other than the root. 2011-05-24 21:19:31 -07:00
Nathan Binkert
ddb0f1bca0 style: fix all_regions code and remove bogus region type 2011-04-17 14:21:04 -07:00
Nathan Binkert
6402721d8e style: remove extra debugging print 2011-04-17 13:57:40 -07:00
Nathan Binkert
50fda09ac7 style: add sort_includes to the style hook 2011-04-15 10:43:51 -07:00
Nathan Binkert
5add771e85 style: move style verifiers into classes 2011-04-15 10:43:47 -07:00
Nathan Binkert
2d5e1de4d9 style: add a user interface wrapper class
makes things work both with mercurial and stand alone with stdio
2011-04-15 10:43:30 -07:00
Gabe Black
43b58ce3ad Style checker: Fix a couple bugs in style.py. 2011-01-13 12:30:18 -08:00
Nathan Binkert
fcc621ac79 style: prevent the style hook from aborting uncleanly because of an exception 2011-01-10 11:11:16 -08:00
Nathan Binkert
3c8cc170d2 style: clean up style hook code a bit
I've renamed the check_whitespace operation to check_style.  You're going to
need to change your .hg/hgrc file.  While you're at it, add a pre-qrefresh
hook please.
2011-01-10 11:11:15 -08:00
Nathan Binkert
fe6574ecc0 style: make style hook work with pre-qrefresh and update to use new code
clean up the code a little bit while we're at it.

I recommend that everyone adds the pre-qrefresh hook below since it
will make qref run the style hook and not just commit/qpush

[extensions]
style = <m5 path>/util/style.py

[hooks]
pretxncommit.style = python:style.check_whitespace
pre-qrefresh.style = python:style.check_whitespace
2010-12-30 12:53:56 -05:00
Nathan Binkert
6bb9486598 style_hook: Fix the style hook
Re-enable it and update it for more modern versions of mercurial.
2010-01-23 09:43:18 -08:00
Polina Dudnik
114d8724dd Functionality migrated to sequencer. 2009-09-17 17:39:52 -05:00
Polina Dudnik
a4fc1bad94 [mq]: first_patch 2009-08-21 15:52:46 -05:00
Nathan Binkert
08043c777f style: fix style hook for some newer versions of mercurial. 2009-04-08 22:21:25 -07:00
Ali Saidi
758d6ccf1f Fix style hook for Mercurial >= 1.1 2009-01-13 00:14:04 -05:00
Clint Smullen
ba8936120e Remove the pointless, repository destroying assertion and just have the script check every line in the file if it cannot get context information. 2008-11-15 00:21:31 -05:00
Nathan Binkert
ed84388b85 Add hg commands for style check so you can check at times other than commit 2008-06-14 19:37:26 -07:00
Steve Reinhardt
b7ea470a97 Fix minor bug in util/style.py
--HG--
extra : convert_revision : d37accc884c2967d87dd267debab5afeb8b6ed85
2007-12-11 10:41:30 -08:00
Nathan Binkert
3555b2aecc style: fix style hook when run from a repo subdir.
Before this fix, the style hook would blow up when you did a qrefresh to add
a new file, but executed the qrefresh from a repository sub directory.

--HG--
extra : convert_revision : 851b0421dfa5c5b23d0f49441c4ba2e0ac579c5d
2007-08-21 16:15:14 -07:00
Nathan Binkert
a9e4daf574 style: Don't try to fix files that should be ignored.
The style hook was ignoring new files, but processing all modified
files.

--HG--
extra : convert_revision : 97400c24a12103d7ac3d4f69b026853816c39d72
2007-08-14 18:21:23 -07:00
Gabe Black
c5c64823fc Merge with head. style.py was also missing an argument in one call to modified_lines.
--HG--
extra : convert_revision : 0f4e23007399f9d0e2be5310062bd61f5415550d
2007-07-29 01:38:07 -07:00
Nathan Binkert
41a1acd1e9 Work around a mercurial bug in bdiff.blocks
--HG--
extra : convert_revision : 597503431883a24f68744bf0dce77356a32d7ff7
2007-07-28 21:56:43 -07:00
Nathan Binkert
9aed27efb3 style: fix stupid bugs
--HG--
extra : convert_revision : ef3dcc3a160eb19a6c4fcdcd411d392aa42e4efe
2007-07-28 16:55:51 -07:00
Nathan Binkert
c27e23f2e8 style: Check/Fix whitespace on SCons files
--HG--
extra : convert_revision : 46e6b2dd8e1984cbab0ea24c94760794734c0f95
2007-07-28 16:49:20 -07:00
Nathan Binkert
552097b92e Allow the fixwhite stuff to work when committing from a subdir
--HG--
extra : convert_revision : 10e6ecc60bb8ee4e4a6f06f8c56550299c262c91
2007-07-23 20:55:57 -07:00
Nathan Binkert
089fce4f59 do proper style checks for merged files
--HG--
extra : convert_revision : f9d4c61ded4b13655dbe86f0bb6a0b3beaf45151
2007-07-22 13:45:12 -07:00
Nathan Binkert
78759ad176 fix the style fixing thing
--HG--
extra : convert_revision : 65ffc14e7b78b49df9a67ef0d3521551dd44d1cd
2007-07-22 09:08:05 -07:00
Nathan Binkert
4b5ba96d38 Add code to turn the style stuff into a mercurial hook.
Nag the user during compile if they have an hg cloned copy of M5, have
mercurial installed, but don't have the style hook enabled.

--HG--
extra : convert_revision : 6bcbb67f1a3fcd36db7d3ef16a9ff19680f126f2
2007-07-21 22:33:08 -07:00