From: Sam H. v. a. <we...@ma...> - 2005-08-01 22:01:36
|
Log Message: ----------- fixed indentation (see crabby reminder below). The code I just fixed was using four spaces for one level of indentation and a tab character for two levels of indentation. apparently, this is a variation on the "use spaces for indentation" philosophy that also replaces any run of eight spaces with a tab. this is NOT the way we've been doing things in webwork, and consistency is important (I think). ===> the webwork indentation policy <=== We use the TAB character to indicate a level of indentation, and SPACE characters to line things up in lists. I understand there is some debate as to whether is it appropriate to use "hard" tabs in text files. We do it because some of the WeBWorK developers prefer to view the code with wider indentation (say, eight columns) and some prefer narrower indentation (say, three or four columns). Thus, we use hard tabs for initial indentation and let each developer chose a tab width using their editor. Here in an example of when to use tabs and spaces. ---> represents a tab character. my %errors = ( --->not_found => "The record was not found.", --->invalid_id => "The record ID is invalid.", --->undefined_or_unknown => "The record was undefined or unknown.", ); sub bar { --->my ($self, @recs) = @_; --->foreach my $rec (@recs) { --->--->my $Rec = $self->getRec($rec); --->--->if ($Rec->error) { --->--->--->warn $errors{$Rec->error}; --->--->} else { --->--->--->foo($Rec->a, $Rec->b); --->--->--->baz( --->--->--->--->origin => $Rec->origin, --->--->--->--->destination => $Rec->destination, --->--->--->--->widgets_per_second => $Rec->widgets_per_second, --->--->--->--->score => $Rec->score, --->--->--->--->email_address => $Rec->email_address, --->--->--->); --->--->} --->} } As you can see, indentation that is used to "line up" elements on adjacent lines uses spaces, while indentation that is used to indicate some structural heirarchy in the code uses tabs. Modified Files: -------------- webwork2/lib/WeBWorK: ContentGenerator.pm Revision Data ------------- Index: ContentGenerator.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator.pm,v retrieving revision 1.141 retrieving revision 1.142 diff -Llib/WeBWorK/ContentGenerator.pm -Llib/WeBWorK/ContentGenerator.pm -u -r1.141 -r1.142 --- lib/WeBWorK/ContentGenerator.pm +++ lib/WeBWorK/ContentGenerator.pm @@ -1414,12 +1414,12 @@ =cut sub hidden_proctor_authen_fields { - my $self = shift; - if ( $self->r->param('proctor_user') ) { - return $self->hidden_fields("proctor_user", "proctor_key"); - } else { - return ''; - } + my $self = shift; + if ( $self->r->param('proctor_user') ) { + return $self->hidden_fields("proctor_user", "proctor_key"); + } else { + return ''; + } } =item url_args(@fields) |