Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No-line-hard-limit Proposal #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

nahuel-soldevilla
Copy link
Member

This proposal is to extend the hard limit that we have in our code formatting options.
Right now is 140, but some times this can be a limitation, or can render less readable code than if it were manually split by the developer according to his/her own criteria.

This is specially useful for sql strings:

sql.append(" and nde.nd_experiment_id in (select ph2.nd_experiment_id " //
	+ "      from cvterm_relationship cvtrscale " //
	+ "           inner join cvterm scale on cvtrscale.object_id = scale.cvterm_id " //
	+ "           inner join cvterm_relationship cvtrdataType on scale.cvterm_id = cvtrdataType.subject_id and cvtrdataType.type_id = " + TermId.HAS_TYPE.getId()
	+ "           inner join cvterm dataType on cvtrdataType.object_id = dataType.cvterm_id " //
	+ "           left join cvtermprop scaleMaxRange on scale.cvterm_id = scaleMaxRange.cvterm_id and scaleMaxRange.type_id = " + TermId.MAX_VALUE.getId()
	+ "           left join cvtermprop scaleMinRange on scale.cvterm_id = scaleMinRange.cvterm_id and scaleMinRange.type_id = " + TermId.MIN_VALUE.getId()
	+ " inner join phenotype ph2 on cvtrscale.subject_id = ph2.observable_id " //
	+ "    inner join nd_experiment nde2 on ph2.nd_experiment_id = nde2.nd_experiment_id " //
	+ "           inner join project p2 on nde2.project_id = p2.project_id " //
	+ "           left join variable_overrides vo on vo.cvterm_id = ph2.observable_id and p2.program_uuid = vo.program_uuid " //
			+ "      where ph2." + filterByDraftOrValue + " is not null  and ph2." + filterByDraftOrValue + "!= 'missing'" //

Compared to

sql.append(" and nde.nd_experiment_id in (select ph2.nd_experiment_id " //
	+ "      from cvterm_relationship cvtrscale " //
	+ "           inner join cvterm scale on cvtrscale.object_id = scale.cvterm_id " //
	+ "           inner join cvterm_relationship cvtrdataType on scale.cvterm_id = cvtrdataType.subject_id and cvtrdataType.type_id = "
	+ TermId.HAS_TYPE.getId()
	+ "           inner join cvterm dataType on cvtrdataType.object_id = dataType.cvterm_id " //
	+ "           left join cvtermprop scaleMaxRange on scale.cvterm_id = scaleMaxRange.cvterm_id and scaleMaxRange.type_id = "
	+ TermId.MAX_VALUE.getId()
	+ "           left join cvtermprop scaleMinRange on scale.cvterm_id = scaleMinRange.cvterm_id and scaleMinRange.type_id = "
	+ TermId.MIN_VALUE.getId()
	+ " inner join phenotype ph2 on cvtrscale.subject_id = ph2.observable_id " //
	+ "    inner join nd_experiment nde2 on ph2.nd_experiment_id = nde2.nd_experiment_id " //
	+ "           inner join project p2 on nde2.project_id = p2.project_id " //
	+ "           left join variable_overrides vo on vo.cvterm_id = ph2.observable_id and p2.program_uuid = vo.program_uuid " //

This is an example of the typescript codebase, which doesn't seem to have a hard limit on the line length:
https://github.com/microsoft/TypeScript/blob/fd0ad2985b6d88e190dc757abac5a37ba102abb9/src/compiler/commandLineParser.ts#L2053

This proposal is not in favor of long lines, but to avoid automatic splitting.

cc @IntegratedBreedingPlatform/developers

Let the developer decide when to break lines for readability. Useful for
queries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant