Skip to content

PL/SQL & SQL formatter settings based on the Trivadis PL/SQL & SQL Coding Guidelines

License

Notifications You must be signed in to change notification settings

maiconzucco/plsql-formatter-settings

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PL/SQL & SQL Formatter Settings

Introduction

This repository provides formatter settings for the coding style rules of the Trivadis PL/SQL & SQL Coding Guidelines.

Settings are provided for

These settings have been defined and tested with the product versions mentioned above. They might not work in other versions.

Deviating Settings

Please note that these settings do not comply with rule 5. Line breaks are placed after a comma and not before. All other rules are followed. However, you can easily change this in the settings for both products.

Installation

Common

Clone this repository or download the ZIP file and extract it.

SQL Developer

  1. Start SQL Developer
  2. Open Preferences
  3. Select Code Editor -> Format -> Advanced Format
  4. Press Import... Advanced Format
  5. Select trivadis_advanced_format.xml
  6. Press Open
  7. Select Code Editor -> Format -> Advanced Format -> Custom Format
  8. Press Import... Custom Format
  9. Select trivadis_custom_format.arbori
  10. Press Open
  11. Press OK to save the settings

PL/SQL Developer

  1. Start PL/SQL Developer
  2. Open Preferences
  3. Select User interface -> PL/SQL Beautifier
  4. Press Edit...
  5. Press Open... PL/SQL Beautifier
  6. Select trivadis_beautifier.br
  7. Press Open
  8. Press Save as...
  9. Select a permanent location for these settings and press Save
  10. Press Close
  11. Select the rule file you've saved previoulsy.
  12. Press OK

Arbori

SQL Developer uses its own parse tree query language called Arbori for its advanced formatter configuration. Here is some additional information that might be useful if you plan to tweak the behavior of the formatter yourself.

Links

Thank you, Vadim Tropashko for providing this valuable information.

JavaScript Global Variables

To get the most out of the dynamic JavaScript actions from an Arbori program, you should know the following global variables and their corresponding Java class.

Variable Type JAR File
struct oracle.dbtools.raptor.config.CustomFormat oracle.sqldeveloper.jar
target oracle.dbtools.parser.Parsed dbtools-common.jar
tuple HashMap<String, oracle.dbtools.parser.ParseNode> dbtools-common.jar
logger oracle.dbtools.util.Logger dbtools-common.jar

Issues

Please file your bug reports, enhancement requests, questions and other support requests within Github's issue tracker.

How to Contribute

  1. Describe your idea by submitting an issue
  2. Fork the PL/SQL & SQL Formatter Settings respository
  3. Create a branch, commit and publish your changes and enhancements
  4. Create a pull request

License

The Trivadis PL/SQL & SQL Formatter Settings are licensed under the Apache License, Version 2.0. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

About

PL/SQL & SQL formatter settings based on the Trivadis PL/SQL & SQL Coding Guidelines

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Xtend 55.4%
  • PLpgSQL 32.2%
  • TSQL 7.1%
  • Java 5.3%