All Projects → kvokka → Pp_sql

kvokka / Pp_sql

Licence: mit
Rails ActiveRecord SQL queries log beautifier

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Pp sql

Unibeautify
One Beautifier to rule them all, One Beautifier to clean them, One Beautifier to bring them all and in the darkness sheen them
Stars: ✭ 466 (+108.97%)
Mutual labels:  beautify, beautifier, formatter
Atom Beautify
📣 Help Wanted - Looking for Maintainer: https://github.com/Glavin001/atom-beautify/issues/2572 | 💄 Universal beautification package for Atom editor (⚠️ Currently migrating to https://github.com/Unibeautify/ and have very limited bandwidth for Atom-Beautify Issues. Thank you for your patience and understanding ❤️ )
Stars: ✭ 1,501 (+573.09%)
Mutual labels:  beautify, beautifier, formatter
Uncrustify
Code beautifier
Stars: ✭ 2,442 (+995.07%)
Mutual labels:  beautify, beautifier, formatter
Latexindent.pl
Perl script to add indentation (leading horizontal space) to LaTeX files. It can modify line breaks before, during and after code blocks; it can perform text wrapping and paragraph line break removal. It can also perform string-based and regex-based substitutions/replacements. The script is customisable through its YAML interface.
Stars: ✭ 415 (+86.1%)
Mutual labels:  beautify, beautifier, formatter
Mbeautifier
MBeautifier is a MATLAB source code formatter, beautifier. It can be used directly in the MATLAB Editor and it is configurable.
Stars: ✭ 248 (+11.21%)
Mutual labels:  beautify, beautifier, formatter
atom-perfectionist
Beautify CSS and SCSS
Stars: ✭ 19 (-91.48%)
Mutual labels:  formatter, beautify
pretty-remarkable
Plugin for prettifying markdown with https://github.com/jonschlinkert/remarkable using custom renderer rules.
Stars: ✭ 22 (-90.13%)
Mutual labels:  formatter, beautify
Sh
A shell parser, formatter, and interpreter with bash support; includes shfmt
Stars: ✭ 4,343 (+1847.53%)
Mutual labels:  beautify, formatter
Go Mod Outdated
Find outdated dependencies of your Go projects. go-mod-outdated provides a table view of the go list -u -m -json all command which lists all dependencies of a Go project and their available minor and patch updates. It also provides a way to filter indirect dependencies and dependencies without updates.
Stars: ✭ 474 (+112.56%)
Mutual labels:  beautify, beautifier
Sql Formatter
A whitespace formatter for different query languages
Stars: ✭ 779 (+249.33%)
Mutual labels:  sql, formatter
Sqlformat
.NET SQL Parser and Formatter Tool and SSMS Plugin
Stars: ✭ 49 (-78.03%)
Mutual labels:  sql, formatter
tag-picker
Better tags input interaction with JavaScript.
Stars: ✭ 27 (-87.89%)
Mutual labels:  beautify, beautifier
Sublime-Pretty-Shell
🐚 Shell Script Formatter / Syntax Checker (Powered by shfmt)
Stars: ✭ 28 (-87.44%)
Mutual labels:  formatter, beautify
vscode-liquid
💧Liquid language support for VS Code
Stars: ✭ 137 (-38.57%)
Mutual labels:  formatter, beautifier
Plugin Php
Prettier PHP Plugin
Stars: ✭ 1,243 (+457.4%)
Mutual labels:  beautifier, formatter
Spotless
Keep your code spotless
Stars: ✭ 2,285 (+924.66%)
Mutual labels:  sql, formatter
stylus-supremacy
A Node.js script that helps formatting Stylus files.
Stars: ✭ 86 (-61.43%)
Mutual labels:  formatter, beautifier
Git-Beautify-For-MacOS-Terminal
An easy-to-use set of config files to beautify Git in your MacOS or OS X terminal. If you find it hard to parse a jumble of mono-colored type on your command line, this set-up can help you tame the ugly bash beast.
Stars: ✭ 127 (-43.05%)
Mutual labels:  beautify, beautifier
Typeset
自动修正中文、英文、代码混合排版中的全半角、空格等问题
Stars: ✭ 63 (-71.75%)
Mutual labels:  beautifier, formatter
Vim Autoformat
Provide easy code formatting in Vim by integrating existing code formatters.
Stars: ✭ 2,000 (+796.86%)
Mutual labels:  beautify, formatter

PpSql

Version               Build Status          Codacy Badge          Reviewed by Hound

Replace standard ActiveRecord#to_sql method with anbt-sql-formatter gem for pretty SQL code output in console. Rails log will be formatted also. Example output:

log

Or in console

console

Require

Ruby 2.4+

Rails

Rails 4.2+ (optional), will be injected automatically

Legacy

You can use version ~> 0.2 of this gem with Ruby 2.2, 2.3 and/or Rails 4.0, 4.1

Usage

Post.first.to_sql

for easy and clean usage with custom string you can use build-in refinement:

  using PpSql::ToSqlBeautifyRefinement

Or if you need to use it wider

class MyAwesomeDecoratedString < String
  include PpSql::ToSqlBeautify
end

Installation

add in Gemfile

gem 'pp_sql', group: :development

And then execute:

$ bundle

With other formatters

If you are pry user, or use custom output formatter, use puts for output whitespaces, like puts User.all.to_sql, or use User.all.pp_sql.

With Rails

If you do not want to rewrite default #to_sql method you may specify PpSql.rewrite_to_sql_method=false in initializers.

You can also disable log formatting by specifying PpSql.add_rails_logger_formatting=false in initializers.

Add to Application record

I found usefull this trick:

class ApplicationRecord < ActiveRecord::Base
 include PpSql::ToSqlBeautify if defined?(Rails::Console)

 self.abstract_class = true
end

Supported by

jetbrains

Contributing

Running the tests requires sqlite. To run the tests for different combinations of dependency versions, run bundle exec appraisal install followed by bundle exec appraisal rake.

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].