Skip to content

Commit

Permalink
chore: format with cfformat
Browse files Browse the repository at this point in the history
  • Loading branch information
elpete committed Apr 29, 2020
1 parent da7eb88 commit ad9d544
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 18 deletions.
6 changes: 3 additions & 3 deletions box.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"shortDescription":"A ColdBox ORM Engine",
"description":"A ColdBox ORM Engine",
"scripts":{
"format":"cfformat run dsl/**/*.cfc,extras/**/*.cfc,interceptors/**/*.cfc,models/**/*.cfc,tests/specs/**/*.cfc --overwrite",
"format:check":"cfformat check dsl/**/*.cfc,extras/**/*.cfc,interceptors/**/*.cfc,models/**/*.cfc,tests/specs/**/*.cfc --verbose",
"format:watch":"cfformat watch dsl/**/*.cfc,extras/**/*.cfc,interceptors/**/*.cfc,models/**/*.cfc,tests/specs/**/*.cfc",
"format":"cfformat run dsl/**/*.cfc,extras/**/*.cfc,models/**/*.cfc,tests/specs/**/*.cfc --overwrite",
"format:check":"cfformat check dsl/**/*.cfc,extras/**/*.cfc,models/**/*.cfc,tests/specs/**/*.cfc --verbose",
"format:watch":"cfformat watch dsl/**/*.cfc,extras/**/*.cfc,models/**/*.cfc,tests/specs/**/*.cfc",
"generateAPIDocs":"rm .tmp --recurse --force && docbox generate mapping=quick excludes=test|/modules|ModuleConfig|QuickCollection strategy-outputDir=.tmp/apidocs strategy-projectTitle=Quick"
},
"type":"modules",
Expand Down
21 changes: 12 additions & 9 deletions models/BaseEntity.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,10 @@ component accessors="true" {
* @doc_generic string
* @return [string]
*/
public array function retrieveAttributeNames( boolean asColumnNames = false, boolean withVirtualAttributes = false ) {
public array function retrieveAttributeNames(
boolean asColumnNames = false,
boolean withVirtualAttributes = false
) {
return variables._attributes.reduce( function( items, key, value ) {
if ( value.virtual && !withVirtualAttributes ) {
return items;
Expand Down Expand Up @@ -2767,7 +2770,7 @@ component accessors="true" {
variables._applyingGlobalScopes = true;
applyGlobalScopes();
variables._applyingGlobalScopes = false;
variables._globalScopesApplied = true;
variables._globalScopesApplied = true;
}
return this;
}
Expand Down Expand Up @@ -2920,16 +2923,16 @@ component accessors="true" {
if ( !isStruct( variables._meta ) || structIsEmpty( variables._meta ) ) {
variables._meta = duplicate(
variables._cache.getOrSet( "quick-metadata:#variables._mapping#", function() {
var util = createObject( "component", "coldbox.system.core.util.Util" );
var meta = {};
meta[ "originalMetadata" ] = util.getInheritedMetadata( this );
meta[ "localMetadata" ] = getMetadata( this );
var util = createObject( "component", "coldbox.system.core.util.Util" );
var meta = {};
meta[ "originalMetadata" ] = util.getInheritedMetadata( this );
meta[ "localMetadata" ] = getMetadata( this );
if (
!meta[ "localMetadata" ].keyExists( "accessors" ) ||
meta[ "localMetadata" ].accessors == false
) {
throw(
type = "QuickAccessorsMissing",
type = "QuickAccessorsMissing",
message = 'This instance is missing `accessors="true"` in the component metadata. This is required for Quick to work properly. Please add it to your component metadata and reinit your application.'
);
}
Expand Down Expand Up @@ -3028,8 +3031,8 @@ component accessors="true" {
public any function appendVirtualAttribute( required string name ) {
if ( !variables._attributes.keyExists( retrieveAliasForColumn( arguments.name ) ) ) {
variables._attributes[ arguments.name ] = paramAttribute( {
"name" : arguments.name,
"virtual": true
"name" : arguments.name,
"virtual" : true
} );
variables._meta.attributes[ arguments.name ] = variables._attributes[ arguments.name ];
variables._meta.originalMetadata.properties.append(
Expand Down
10 changes: 8 additions & 2 deletions models/QuickBuilder.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ component extends="qb.models.Query.QueryBuilder" accessors="true" {
} );
} );

arguments.relationQuery = relation.addCompareConstraints().clearOrders().select( relation.raw( 1 ) );
arguments.relationQuery = relation
.addCompareConstraints()
.clearOrders()
.select( relation.raw( 1 ) );

if ( listLen( arguments.relationshipName, "." ) > 1 ) {
arguments.relationshipName = listRest( arguments.relationshipName, "." );
Expand Down Expand Up @@ -531,7 +534,10 @@ component extends="qb.models.Query.QueryBuilder" accessors="true" {
} );
} );
q = relationship.whereExists(
relationship.addCompareConstraints( q.select( q.raw( 1 ) ) ).clearOrders().retrieveQuery()
relationship
.addCompareConstraints( q.select( q.raw( 1 ) ) )
.clearOrders()
.retrieveQuery()
);
}
arguments.relationshipName = listRest( arguments.relationshipName, "." );
Expand Down
2 changes: 1 addition & 1 deletion tests/specs/integration/BaseEntity/AttributeCastsSpec.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
} );

it( "can use multiple attributes for casting", function() {
var user = getInstance( "User" ).findOrFail( 1 );
var user = getInstance( "User" ).findOrFail( 1 );
expect( user.getAddress() ).notToBeNull();
var address = user.getAddress();
expect( address.fullStreet() ).toBe( "123 Elm Street" );
Expand Down
3 changes: 1 addition & 2 deletions tests/specs/integration/BaseEntity/ReadOnlyPropertySpec.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
expect( link.getUrl() ).toBe( "http://example.com/some-link" );
expect( link.getCreatedDate() ).toBe( "2017-07-28 02:07:00" );

link
.setUrl( "https://example.com/" )
link.setUrl( "https://example.com/" )
.setCreatedDate( now() )
.save();

Expand Down
2 changes: 1 addition & 1 deletion tests/specs/integration/GoodErrorMessagesSpec.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
expect( function() {
getInstance( "EntityWithoutAccessors" );
} ).toThrow(
type = "QuickAccessorsMissing",
type = "QuickAccessorsMissing",
regex = 'This instance is missing \`accessors\=\"true\"\` in the component metadata\. This is required for Quick to work properly\. Please add it to your component metadata and reinit your application\.'
);
} );
Expand Down

0 comments on commit ad9d544

Please sign in to comment.