Recently as a result of using Git I''ve noticed a number of  
inconsistencies in the RSpec codebase with respect to whitespace  
(mixed line endings, mixed use of spaces and tabs for indentation,  
and trailing whitespace at the end of lines). I never would have  
noticed, but Git produces nice colorized diff output which highlights  
these kinds of inconsistencies.
I wanted to ask if the core RSpec team had established any  
conventions/standards for these things. The basic rationale is that  
if all contributors agree to a small number of conventions for  
whitespace there are less likely to be changesets with non- 
substantive whitespace differences (really, false alarms).
The procedure I used to explore this was as follows:
First export a clean copy of the trunk:
   svn export svn://rubyforge.org/var/svn/rspec/trunk rspec-trunk
   cd rspec-trunk
Then use the following Bash incantation to see which files had UNIX,  
Mac or Windows line endings:
IFS="
"
for FILE in $(find . -type f)
do
   if ! perl -ne "exit 1 if m/\r/;" "$FILE"; then
     echo "CR detected in : $FILE"
   else
     echo "ok             : $FILE"
   fi
done
All text files used UNIX line endings (LF) with the exception of  
these four, which used Windows line endings (CRLF):
doc/src/default.css
rspec/bin/spec_translator
spec_ui/examples/selenium/README.txt
spec_ui/History.txt
I did a similar Bash thing to find out which files had tabs in them;  
many of them appear to consistently use tabs for indentation but some  
do not, using a mixture of tabs and spaces.
doc/src/breadcrumbs.css
doc/src/default.css
doc/src/default.template
rspec/lib/spec/runner/formatter/base_text_formatter.rb
rspec/lib/spec/runner/formatter/html_formatter.rb
rspec/lib/spec/runner/spec_parser.rb
rspec/spec/spec/runner/formatter/html_formatted-1.8.4.html
rspec/spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html
rspec/spec/spec/runner/formatter/html_formatted-1.8.5.html
rspec/spec/spec/runner/formatter/html_formatted-1.8.6.html
RSpec.tmbundle/Commands/Alternate File.tmCommand
RSpec.tmbundle/Commands/Run Focussed Specification.tmCommand
RSpec.tmbundle/Commands/Run Specifications - Normal.tmCommand
RSpec.tmbundle/Commands/Run Specifications in selected files or  
directories.tmCommand
RSpec.tmbundle/info.plist
RSpec.tmbundle/Snippets/and_raise.tmSnippet
RSpec.tmbundle/Snippets/and_return_block.tmSnippet
RSpec.tmbundle/Snippets/and_return_value.tmSnippet
RSpec.tmbundle/Snippets/and_throw.tmSnippet
RSpec.tmbundle/Snippets/and_yield.tmSnippet
RSpec.tmbundle/Snippets/any_number_of_times.tmSnippet
RSpec.tmbundle/Snippets/at_least.tmSnippet
RSpec.tmbundle/Snippets/at_least_once.tmSnippet
RSpec.tmbundle/Snippets/at_least_twice.tmSnippet
RSpec.tmbundle/Snippets/at_most.tmSnippet
RSpec.tmbundle/Snippets/at_most_once.tmSnippet
RSpec.tmbundle/Snippets/at_most_twice.tmSnippet
RSpec.tmbundle/Snippets/controller_context.tmSnippet
RSpec.tmbundle/Snippets/controller_context_RESTful.tmSnippet
RSpec.tmbundle/Snippets/Custom Matcher.tmSnippet
RSpec.tmbundle/Snippets/Describe.tmSnippet
RSpec.tmbundle/Snippets/Describe_type.tmSnippet
RSpec.tmbundle/Snippets/Describe_type_string.tmSnippet
RSpec.tmbundle/Snippets/exactly.tmSnippet
RSpec.tmbundle/Snippets/It.tmSnippet
RSpec.tmbundle/Snippets/mock.tmSnippet
RSpec.tmbundle/Snippets/once.tmSnippet
RSpec.tmbundle/Snippets/Require spec_helper.tmSnippet
RSpec.tmbundle/Snippets/response_should_be_success.tmSnippet
RSpec.tmbundle/Snippets/response_should_not_be_success.tmSnippet
RSpec.tmbundle/Snippets/Set Controller for Spec.tmSnippet
RSpec.tmbundle/Snippets/setup.tmSnippet
RSpec.tmbundle/Snippets/should ==.tmSnippet
RSpec.tmbundle/Snippets/should =~.tmSnippet
RSpec.tmbundle/Snippets/should eql.tmSnippet
RSpec.tmbundle/Snippets/should_be.tmSnippet
RSpec.tmbundle/Snippets/should_be_a_kind_of.tmSnippet
RSpec.tmbundle/Snippets/should_be_an_instance_of.tmSnippet
RSpec.tmbundle/Snippets/should_be_close.tmSnippet
RSpec.tmbundle/Snippets/should_be_redirect.tmSnippet
RSpec.tmbundle/Snippets/should_equal.tmSnippet
RSpec.tmbundle/Snippets/should_have.tmSnippet
RSpec.tmbundle/Snippets/should_have_at_least.tmSnippet
RSpec.tmbundle/Snippets/should_have_at_most.tmSnippet
RSpec.tmbundle/Snippets/should_have_records.tmSnippet
RSpec.tmbundle/Snippets/should_include.tmSnippet
RSpec.tmbundle/Snippets/should_match.tmSnippet
RSpec.tmbundle/Snippets/should_not ==.tmSnippet
RSpec.tmbundle/Snippets/should_not =~.tmSnippet
RSpec.tmbundle/Snippets/should_not eql.tmSnippet
RSpec.tmbundle/Snippets/should_not_be.tmSnippet
RSpec.tmbundle/Snippets/should_not_be_a_kind_of.tmSnippet
RSpec.tmbundle/Snippets/should_not_be_an_instance_of.tmSnippet
RSpec.tmbundle/Snippets/should_not_be_close.tmSnippet
RSpec.tmbundle/Snippets/should_not_be_redirect.tmSnippet
RSpec.tmbundle/Snippets/should_not_equal.tmSnippet
RSpec.tmbundle/Snippets/should_not_include.tmSnippet
RSpec.tmbundle/Snippets/should_not_match.tmSnippet
RSpec.tmbundle/Snippets/should_not_predicate.tmSnippet
RSpec.tmbundle/Snippets/should_not_raise.tmSnippet
RSpec.tmbundle/Snippets/should_not_receive.tmSnippet
RSpec.tmbundle/Snippets/should_not_respond_to.tmSnippet
RSpec.tmbundle/Snippets/should_not_satisfy.tmSnippet
RSpec.tmbundle/Snippets/should_not_throw.tmSnippet
RSpec.tmbundle/Snippets/should_predicate.tmSnippet
RSpec.tmbundle/Snippets/should_raise.tmSnippet
RSpec.tmbundle/Snippets/should_receive.tmSnippet
RSpec.tmbundle/Snippets/should_receive_with_any_args.tmSnippet
RSpec.tmbundle/Snippets/should_receive_with_args.tmSnippet
RSpec.tmbundle/Snippets/should_receive_with_no_args.tmSnippet
RSpec.tmbundle/Snippets/should_redirect_to.tmSnippet
RSpec.tmbundle/Snippets/should_render.tmSnippet
RSpec.tmbundle/Snippets/should_respond_to.tmSnippet
RSpec.tmbundle/Snippets/should_satisfy.tmSnippet
RSpec.tmbundle/Snippets/should_throw.tmSnippet
RSpec.tmbundle/Snippets/teardown.tmSnippet
RSpec.tmbundle/Snippets/twice.tmSnippet
rspec_on_rails/generators/rspec/templates/script/spec_server
Finally I did a search for trailing whitespace. Which yielded the  
following list. Many of the lines contain nothing but whitespace;  
sometimes this use is consistent (ie. the whitespace corresponds to  
the nesting level of the current scope) but at other times it is not.
doc/metainfo.yaml
doc/plugin/breadcrumbs.rb
doc/plugin/rspec_content.rb
doc/plugin/svn_tag.rb
doc/plugin/syntax.rb
doc/plugin/version.rb
doc/src/breadcrumbs.css
doc/src/community/contribute.page
doc/src/community/index.page
doc/src/default.template
doc/src/documentation/before_and_after.page
doc/src/documentation/index.page
doc/src/documentation/mocks/index.page
doc/src/documentation/mocks/mocks.page
doc/src/documentation/rails/generators.page
doc/src/documentation/rails/index.page
doc/src/documentation/rails/install.page
doc/src/documentation/rails/runners.page
doc/src/documentation/rails/writing/index.page
doc/src/documentation/tools/extensions/editors/index.page
doc/src/documentation/tools/extensions/editors/textmate.page
doc/src/documentation/tools/heckle.page
doc/src/documentation/tools/index.page
doc/src/documentation/tools/rake.page
doc/src/documentation/tools/rcov.page
doc/src/documentation/tools/spec.page
doc/src/download.page
doc/src/images/ducks1.png
doc/src/index.page
doc/src/upgrade.page
example_rails_app/app/controllers/naughty_controller.rb
example_rails_app/app/controllers/people_controller.rb
example_rails_app/app/helpers/people_helper.rb
example_rails_app/app/models/person.rb
example_rails_app/config/boot.rb
example_rails_app/config/environment.rb
example_rails_app/config/environments/test.rb
example_rails_app/config/routes.rb
example_rails_app/db/migrate/004_create_things.rb
example_rails_app/lib/tasks/bootstrap_rspec.rake
example_rails_app/public/.htaccess
example_rails_app/public/index.html
example_rails_app/public/javascripts/controls.js
example_rails_app/public/javascripts/dragdrop.js
example_rails_app/public/javascripts/effects.js
example_rails_app/spec/controllers/naughty_controller_spec.rb
example_rails_app/spec/controllers/people_controller_spec.rb
example_rails_app/spec/fixtures/animals.yml
example_rails_app/spec/helpers/people_helper_spec.rb
example_rails_app/spec/models/person_spec.rb
example_rails_app/spec/views/person/create_view_spec.rb
example_rails_app/spec/views/person/show_view_spec.rb
example_rails_app/spec/watir/person_spec.rb
example_rails_app/TODO
pre_commit/lib/pre_commit/core.rb
pre_commit/lib/pre_commit/pre_commit.rb
pre_commit/lib/pre_commit/rspec.rb
pre_commit/lib/pre_commit/rspec_on_rails.rb
pre_commit/spec/pre_commit/pre_commit_spec.rb
pre_commit/spec/pre_commit/rspec_on_rails_spec.rb
rspec/CHANGES
rspec/examples/auto_spec_description_example.rb
rspec/examples/before_and_after_example.rb
rspec/examples/behave_as_example.rb
rspec/examples/custom_expectation_matchers.rb
rspec/examples/file_accessor.rb
rspec/examples/file_accessor_spec.rb
rspec/examples/helper_method_example.rb
rspec/examples/legacy_spec.rb
rspec/examples/predicate_example.rb
rspec/examples/shared_behaviours_example.rb
rspec/examples/stack.rb
rspec/examples/stack_spec.rb
rspec/examples/stubbing_example.rb
rspec/examples/test_case_adapter_example.rb
rspec/examples/test_case_spec.rb
rspec/failing_examples/failure_in_setup.rb
rspec/failing_examples/failure_in_teardown.rb
rspec/failing_examples/mocking_example.rb
rspec/failing_examples/predicate_example.rb
rspec/failing_examples/raising_example.rb
rspec/failing_examples/team_spec.rb
rspec/lib/autotest/rspec.rb
rspec/lib/spec/dsl/behaviour.rb
rspec/lib/spec/dsl/behaviour_callbacks.rb
rspec/lib/spec/dsl/behaviour_eval.rb
rspec/lib/spec/dsl/behaviour_factory.rb
rspec/lib/spec/dsl/configuration.rb
rspec/lib/spec/dsl/description.rb
rspec/lib/spec/dsl/example.rb
rspec/lib/spec/dsl/example_matcher.rb
rspec/lib/spec/dsl/example_should_raise_handler.rb
rspec/lib/spec/expectations/differs/default.rb
rspec/lib/spec/expectations/handler.rb
rspec/lib/spec/expectations.rb
rspec/lib/spec/extensions/object.rb
rspec/lib/spec/matchers/be.rb
rspec/lib/spec/matchers/be_close.rb
rspec/lib/spec/matchers/change.rb
rspec/lib/spec/matchers/eql.rb
rspec/lib/spec/matchers/equal.rb
rspec/lib/spec/matchers/has.rb
rspec/lib/spec/matchers/have.rb
rspec/lib/spec/matchers/include.rb
rspec/lib/spec/matchers/match.rb
rspec/lib/spec/matchers/operator_matcher.rb
rspec/lib/spec/matchers/raise_error.rb
rspec/lib/spec/matchers/respond_to.rb
rspec/lib/spec/matchers/satisfy.rb
rspec/lib/spec/matchers/throw_symbol.rb
rspec/lib/spec/matchers.rb
rspec/lib/spec/mocks/argument_constraint_matchers.rb
rspec/lib/spec/mocks/argument_expectation.rb
rspec/lib/spec/mocks/error_generator.rb
rspec/lib/spec/mocks/errors.rb
rspec/lib/spec/mocks/message_expectation.rb
rspec/lib/spec/mocks/methods.rb
rspec/lib/spec/mocks/mock.rb
rspec/lib/spec/mocks/order_group.rb
rspec/lib/spec/mocks/proxy.rb
rspec/lib/spec/mocks/space.rb
rspec/lib/spec/mocks/spec_methods.rb
rspec/lib/spec/mocks.rb
rspec/lib/spec/rake/spectask.rb
rspec/lib/spec/rake/verify_rcov.rb
rspec/lib/spec/runner/backtrace_tweaker.rb
rspec/lib/spec/runner/behaviour_runner.rb
rspec/lib/spec/runner/command_line.rb
rspec/lib/spec/runner/extensions/kernel.rb
rspec/lib/spec/runner/extensions/object.rb
rspec/lib/spec/runner/formatter/base_formatter.rb
rspec/lib/spec/runner/formatter/base_text_formatter.rb
rspec/lib/spec/runner/formatter/failing_behaviours_formatter.rb
rspec/lib/spec/runner/formatter/failing_examples_formatter.rb
rspec/lib/spec/runner/formatter/html_formatter.rb
rspec/lib/spec/runner/formatter/progress_bar_formatter.rb
rspec/lib/spec/runner/formatter/rdoc_formatter.rb
rspec/lib/spec/runner/formatter/snippet_extractor.rb
rspec/lib/spec/runner/formatter/specdoc_formatter.rb
rspec/lib/spec/runner/heckle_runner.rb
rspec/lib/spec/runner/option_parser.rb
rspec/lib/spec/runner/options.rb
rspec/lib/spec/runner/reporter.rb
rspec/lib/spec/runner/spec_parser.rb
rspec/lib/spec/runner.rb
rspec/lib/spec/translator.rb
rspec/lib/spec/version.rb
rspec/Rakefile
rspec/README
rspec/spec/spec/dsl/behaviour_eval_spec.rb
rspec/spec/spec/dsl/behaviour_factory_spec.rb
rspec/spec/spec/dsl/behaviour_spec.rb
rspec/spec/spec/dsl/configuration_spec.rb
rspec/spec/spec/dsl/description_spec.rb
rspec/spec/spec/dsl/example_class_spec.rb
rspec/spec/spec/dsl/example_instance_spec.rb
rspec/spec/spec/dsl/example_should_raise_spec.rb
rspec/spec/spec/dsl/predicate_matcher_spec.rb
rspec/spec/spec/dsl/shared_behaviour_spec.rb
rspec/spec/spec/expectations/extensions/object_spec.rb
rspec/spec/spec/expectations/fail_with_spec.rb
rspec/spec/spec/matchers/be_spec.rb
rspec/spec/spec/matchers/change_spec.rb
rspec/spec/spec/matchers/description_generation_spec.rb
rspec/spec/spec/matchers/exist_spec.rb
rspec/spec/spec/matchers/handler_spec.rb
rspec/spec/spec/matchers/have_spec.rb
rspec/spec/spec/matchers/matcher_methods_spec.rb
rspec/spec/spec/matchers/operator_matcher_spec.rb
rspec/spec/spec/matchers/raise_error_spec.rb
rspec/spec/spec/matchers/respond_to_spec.rb
rspec/spec/spec/matchers/throw_symbol_spec.rb
rspec/spec/spec/mocks/any_number_of_times_spec.rb
rspec/spec/spec/mocks/bug_report_11545_spec.rb
rspec/spec/spec/mocks/bug_report_7611_spec.rb
rspec/spec/spec/mocks/bug_report_8302_spec.rb
rspec/spec/spec/mocks/failing_mock_argument_constraints_spec.rb
rspec/spec/spec/mocks/mock_ordering_spec.rb
rspec/spec/spec/mocks/mock_space_spec.rb
rspec/spec/spec/mocks/mock_spec.rb
rspec/spec/spec/mocks/multiple_return_value_spec.rb
rspec/spec/spec/mocks/once_counts_spec.rb
rspec/spec/spec/mocks/partial_mock_spec.rb
rspec/spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb
rspec/spec/spec/mocks/passing_mock_argument_constraints_spec.rb
rspec/spec/spec/mocks/stub_spec.rb
rspec/spec/spec/mocks/twice_counts_spec.rb
rspec/spec/spec/runner/behaviour_runner_spec.rb
rspec/spec/spec/runner/command_line_spec.rb
rspec/spec/spec/runner/drb_command_line_spec.rb
rspec/spec/spec/runner/example_matcher_spec.rb
rspec/spec/spec/runner/execution_context_spec.rb
rspec/spec/spec/runner/extensions/kernel_spec.rb
rspec/spec/spec/runner/formatter/failing_behaviours_formatter_spec.rb
rspec/spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html
rspec/spec/spec/runner/formatter/html_formatter_spec.rb
rspec/spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb
rspec/spec/spec/runner/formatter/progress_bar_formatter_spec.rb
rspec/spec/spec/runner/formatter/rdoc_formatter_dry_run_spec.rb
rspec/spec/spec/runner/formatter/rdoc_formatter_spec.rb
rspec/spec/spec/runner/formatter/specdoc_formatter_dry_run_spec.rb
rspec/spec/spec/runner/noisy_backtrace_tweaker_spec.rb
rspec/spec/spec/runner/option_parser_spec.rb
rspec/spec/spec/runner/options_spec.rb
rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb
rspec/spec/spec/runner/reporter_spec.rb
rspec/spec/spec/runner/spec_parser_spec.rb
rspec/spec/spec/spec_classes.rb
rspec/spec/spec/translator_spec.rb
rspec/spec.opts
rspec/UPGRADE
RSpec.tmbundle/Support/lib/spec/mate/switch_command.rb
RSpec.tmbundle/Support/lib/spec_mate.rb
RSpec.tmbundle/Support/spec/spec/mate/switch_command_spec.rb
RSpec.tmbundle/Support/spec/spec_mate_spec.rb
rspec_on_rails/generators/rspec/templates/script/spec_server
rspec_on_rails/generators/rspec_controller/templates/helper_spec.rb
rspec_on_rails/generators/rspec_controller/templates/view_spec.rb
rspec_on_rails/generators/rspec_controller/USAGE
rspec_on_rails/generators/rspec_scaffold/rspec_scaffold_generator.rb
rspec_on_rails/generators/rspec_scaffold/templates/controller_spec.rb
rspec_on_rails/generators/rspec_scaffold/templates/edit_erb_spec.rb
rspec_on_rails/generators/rspec_scaffold/templates/index_erb_spec.rb
rspec_on_rails/generators/rspec_scaffold/templates/new_erb_spec.rb
rspec_on_rails/generators/rspec_scaffold/templates/show_erb_spec.rb
rspec_on_rails/lib/autotest/rails_rspec.rb
rspec_on_rails/lib/spec/dsl/configuration.rb
rspec_on_rails/lib/spec/matchers/have.rb
rspec_on_rails/lib/spec/rails/dsl/behaviour/base.rb
rspec_on_rails/lib/spec/rails/dsl/behaviour/controller.rb
rspec_on_rails/lib/spec/rails/dsl/behaviour/functional.rb
rspec_on_rails/lib/spec/rails/dsl/behaviour/helper.rb
rspec_on_rails/lib/spec/rails/dsl/behaviour/render_observer.rb
rspec_on_rails/lib/spec/rails/dsl/behaviour/view.rb
rspec_on_rails/lib/spec/rails/extensions/action_controller/base.rb
rspec_on_rails/lib/spec/rails/matchers/assert_select.rb
rspec_on_rails/lib/spec/rails/matchers/have_text.rb
rspec_on_rails/lib/spec/rails/matchers/redirect_to.rb
rspec_on_rails/lib/spec/rails/matchers/render_template.rb
rspec_on_rails/lib/spec/rails.rb
rspec_on_rails/MIT-LICENSE
rspec_on_rails/spec/rails/autotest/mappings_spec.rb
rspec_on_rails/spec/rails/dsl/behaviour_factory_spec.rb
rspec_on_rails/spec/rails/dsl/configuration_spec.rb
rspec_on_rails/spec/rails/dsl/controller_isolation_spec.rb
rspec_on_rails/spec/rails/dsl/controller_spec_spec.rb
rspec_on_rails/spec/rails/dsl/helper_spec_spec.rb
rspec_on_rails/spec/rails/dsl/ivar_proxy_spec.rb
rspec_on_rails/spec/rails/dsl/shared_behaviour_spec.rb
rspec_on_rails/spec/rails/dsl/view_spec_spec.rb
rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
rspec_on_rails/spec/rails/extensions/active_record_spec.rb
rspec_on_rails/spec/rails/matchers/assert_select_spec.rb
rspec_on_rails/spec/rails/matchers/description_generation_spec.rb
rspec_on_rails/spec/rails/matchers/redirect_to_spec.rb
rspec_on_rails/spec/rails/matchers/render_spec.rb
rspec_on_rails/spec/spec_helper.rb
rspec_on_rails/spec_resources/controllers/controller_spec_controller.rb
rspec_on_rails/spec_resources/controllers/redirect_spec_controller.rb
rspec_on_rails/spec_resources/controllers/render_spec_controller.rb
rspec_on_rails/spec_resources/controllers/rjs_spec_controller.rb
rspec_on_rails/spec_resources/helpers/explicit_helper.rb
rspec_on_rails/tasks/rspec.rake
spec_distributed/lib/spec/distributed/master_runner.rb
spec_distributed/lib/spec/distributed/slave_runner.rb
spec_distributed/Rakefile
spec_distributed/README.txt
spec_distributed/setup.rb
spec_ui/examples/selenium/Rakefile
spec_ui/examples/selenium/spec/spec_helper.rb
spec_ui/examples/watir/Rakefile
spec_ui/examples/watir/spec/watir/find_rspecs_homepage_spec.rb
spec_ui/lib/spec/ui/formatter.rb
spec_ui/lib/spec/ui/selenium/driver_ext.rb
spec_ui/lib/spec/ui/watir/browser.rb
spec_ui/lib/spec/ui/watir/matchers.rb
spec_ui/Rakefile
spec_ui/spec/spec/ui/watir/matchers_spec.rb
No big deal, but just wanted to throw this out there to see what you  
think.
Cheers,
Wincent
On 7/26/07, Wincent Colaiuta <win at wincent.com> wrote:> Recently as a result of using Git I''ve noticed a number of > inconsistencies in the RSpec codebase with respect to whitespace > (mixed line endings, mixed use of spaces and tabs for indentation, > and trailing whitespace at the end of lines). I never would have > noticed, but Git produces nice colorized diff output which highlights > these kinds of inconsistencies. > > I wanted to ask if the core RSpec team had established any > conventions/standards for these things. The basic rationale is that > if all contributors agree to a small number of conventions for > whitespace there are less likely to be changesets with non- > substantive whitespace differences (really, false alarms).Your thinking makes sense, but we haven''t set a standard for this. Do you know how to configure TextMate (which most of us use) to take care of this automagically when saving files?
El 27/7/2007, a las 23:38, David Chelimsky escribi?:> On 7/26/07, Wincent Colaiuta <win at wincent.com> wrote: >> Recently as a result of using Git I''ve noticed a number of >> inconsistencies in the RSpec codebase with respect to whitespace >> (mixed line endings, mixed use of spaces and tabs for indentation, >> and trailing whitespace at the end of lines). I never would have >> noticed, but Git produces nice colorized diff output which highlights >> these kinds of inconsistencies. >> >> I wanted to ask if the core RSpec team had established any >> conventions/standards for these things. The basic rationale is that >> if all contributors agree to a small number of conventions for >> whitespace there are less likely to be changesets with non- >> substantive whitespace differences (really, false alarms). > > Your thinking makes sense, but we haven''t set a standard for this. Do > you know how to configure TextMate (which most of us use) to take care > of this automagically when saving files?I don''t know of any *fully* automatic way to do this in TextMate but there are some things you can do to make it nearly automatic. In my experience I''ve observed a few things: * The initial "clean up" of a code base is the biggest task (although for a project the size of RSpec we are still only talking a few minutes'' work); after that merely maintaining the standards is relatively easy (especially in the case of Git where if you do a "git diff" to see what you are about to commit any problems with the whitespace are immediately evident) * Project-wide Find and Replace does a pretty good job of handling most scenarios; for further "automation" you could record a TextMate macro and assign it to a key combo (for example, to handle trailing whitespace do a regular expression search for " +$" and replace all instances with nothing) * The way the Git community tends to work is to enforce this using repository hooks, and I imagine this could be done in Subversion too: the idea is that you have a pre-commit hook that can check the proposed commit against the standards and reject it if it fails (Git also has a "--no-verify" switch that you can pass if you want to skip the pre-commit hook) * The burden for enforcing the standards need not fall on the maintainers themselves; in the projects I''ve seen it is normal for a maintainer to say things like, "the patch looks good but can you fix up the whitespace and resubmit?" etc Of course, this is extremely easy and natural when using Git because the diff tools really put any discrepancies "in your face". In any case, I think you don''t need to go "all the way" with this; a useful first step would be merely deciding upon some standards and publishing them. Even if you don''t take any further steps (enforcement, hooks, automation etc) the mere act of publishing the standards and asking people to follow them would be useful. Cheers, Wincent
The root Rakefile has a task :fix_cr_lf which I ran a while ago to fix newlines in .rb files. Perhaps it can be improved to scan over more files, and replace \t with '' '' too? I''ll see what I can do. Thoughts? On 7/29/07, Wincent Colaiuta <win at wincent.com> wrote:> El 27/7/2007, a las 23:38, David Chelimsky escribi?: > > > On 7/26/07, Wincent Colaiuta <win at wincent.com> wrote: > >> Recently as a result of using Git I''ve noticed a number of > >> inconsistencies in the RSpec codebase with respect to whitespace > >> (mixed line endings, mixed use of spaces and tabs for indentation, > >> and trailing whitespace at the end of lines). I never would have > >> noticed, but Git produces nice colorized diff output which highlights > >> these kinds of inconsistencies. > >> > >> I wanted to ask if the core RSpec team had established any > >> conventions/standards for these things. The basic rationale is that > >> if all contributors agree to a small number of conventions for > >> whitespace there are less likely to be changesets with non- > >> substantive whitespace differences (really, false alarms). > > > > Your thinking makes sense, but we haven''t set a standard for this. Do > > you know how to configure TextMate (which most of us use) to take care > > of this automagically when saving files? > > I don''t know of any *fully* automatic way to do this in TextMate but > there are some things you can do to make it nearly automatic. In my > experience I''ve observed a few things: > > * The initial "clean up" of a code base is the biggest task (although > for a project the size of RSpec we are still only talking a few > minutes'' work); after that merely maintaining the standards is > relatively easy (especially in the case of Git where if you do a "git > diff" to see what you are about to commit any problems with the > whitespace are immediately evident) > > * Project-wide Find and Replace does a pretty good job of handling > most scenarios; for further "automation" you could record a TextMate > macro and assign it to a key combo (for example, to handle trailing > whitespace do a regular expression search for " +$" and replace all > instances with nothing) > > * The way the Git community tends to work is to enforce this using > repository hooks, and I imagine this could be done in Subversion too: > the idea is that you have a pre-commit hook that can check the > proposed commit against the standards and reject it if it fails (Git > also has a "--no-verify" switch that you can pass if you want to skip > the pre-commit hook) > > * The burden for enforcing the standards need not fall on the > maintainers themselves; in the projects I''ve seen it is normal for a > maintainer to say things like, "the patch looks good but can you fix > up the whitespace and resubmit?" etc Of course, this is extremely > easy and natural when using Git because the diff tools really put any > discrepancies "in your face". > > In any case, I think you don''t need to go "all the way" with this; a > useful first step would be merely deciding upon some standards and > publishing them. Even if you don''t take any further steps > (enforcement, hooks, automation etc) the mere act of publishing the > standards and asking people to follow them would be useful. > > Cheers, > Wincent > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
El 31/7/2007, a las 22:48, aslak hellesoy escribi?:> The root Rakefile has a task :fix_cr_lf which I ran a while ago to fix > newlines in .rb files. Perhaps it can be improved to scan over more > files, and replace \t with '' '' too? > > I''ll see what I can do. > > Thoughts?Sounds like a good idea. I would suggest that \t should be replaced with '' '' only if it is in the leading whitespace for a line; if it is elsewhere in the line it is probably being (mis)used for alignment and it''s probably better to just print a warning showing the filename and then you''d have to visually inspect it as a straight transliteration might not be right (it might be equivalent to one space, not two). I think it''s also worth looking for trailing whitespace as it is almost always an mistake which apports neither semantic meaning nor visual enhancement. Cheers, Wincent
On 7/31/07, Wincent Colaiuta <win at wincent.com> wrote:> El 31/7/2007, a las 22:48, aslak hellesoy escribi?: > > > The root Rakefile has a task :fix_cr_lf which I ran a while ago to fix > > newlines in .rb files. Perhaps it can be improved to scan over more > > files, and replace \t with '' '' too? > > > > I''ll see what I can do. > > > > Thoughts? > > Sounds like a good idea. I would suggest that \t should be replaced > with '' '' only if it is in the leading whitespace for a line; if it > is elsewhere in the line it is probably being (mis)used for alignment > and it''s probably better to just print a warning showing the filename > and then you''d have to visually inspect it as a straight > transliteration might not be right (it might be equivalent to one > space, not two). >Good point> I think it''s also worth looking for trailing whitespace as it is > almost always an mistake which apports neither semantic meaning nor > visual enhancement. >Trailing whitespace is killed with the strip Aslak> Cheers, > Wincent > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >