Opened 7 years ago

Last modified 7 years ago

#1453 closed defect

Consistent formatting of C++/Java code — at Initial Version

Reported by: Dimitar Misev Owned by: Dimitar Misev
Priority: major Milestone: 9.3
Component: undecided Version: development
Keywords: Cc: Vlad Merticariu, Bang Pham Huu, Peter Baumann
Complexity: Medium

Description

The rasdaman C++/Java code should be consistently formatted; this can be done with astyle. Here's a good configuration for astyle that conforms to the rasdaman code style guide:

--suffix=none
--convert-tabs
--exclude=third_party
--options=none
--add-brackets
--convert-tabs
--close-templates
--pad-oper
--pad-header
--unpad-paren
--align-pointer=type
--align-reference=type
--indent-preproc-define
--indent=spaces=4
--recursive

# C++
--style=allman
# Java
#--style=java

This bash script can be used to recursively reformat all C++ and Java files in the directory from which it is executed.

#!/bin/bash
#
# This script reformats the C++/Java code in the rasdaman repository with astyle.
# Execute with no arguments from the top-level source directory.
#

reformat() {
astyle \
  --suffix=none \
  --convert-tabs \
  --exclude=third_party \
  --options=none \
  --add-brackets \
  --convert-tabs \
  --close-templates \
  --pad-oper \
  --pad-header \
  --unpad-paren \
  --align-pointer=type \
  --align-reference=type \
  --indent-preproc-define \
  --indent=spaces=4 \
  --recursive \
  $@
}

reformat --style=allman --mode=c '*.cc *.hh *.h *.c *.cpp *.hpp *.sc'
reformat --style=java --mode=java '*.java'

Change History (1)

by Dimitar Misev, 7 years ago

Attachment: format-sources.sh added
Note: See TracTickets for help on using tickets.