-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report for cookbooks without recipes
Summary: Cookbooks that don't evaluate Ruby outside of recipes presumably are easier to remove from other cookbook dependencies, since without an include_recipe call to a recipe they will be unlikely to have any purpose (though this is not a substitute for checking for other usage). Differential Revision: D52215844 fbshipit-source-id: 876dacc0e686168fdda72f2064949e25ce61c998
- Loading branch information
1 parent
0f6aab9
commit e17c840
Showing
7 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
cookbooks/fb_bookworm/files/default/bookworm/reports/RecipeOnlyCookbooks.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright (c) 2023-present, Meta, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
description 'Determines all cookbooks that do not evaluate Ruby code on load' | ||
needs_rules %w{ | ||
MetadatarbExists | ||
AttributeExists | ||
LibraryExists | ||
ResourceExists | ||
ProviderExists | ||
} | ||
|
||
def to_a | ||
cookbooks = Set.new(@kb.cookbooks.keys) | ||
cookbooks.subtract(Set.new(@kb.attributes.map { |_, c| c['cookbook'] })) | ||
cookbooks.subtract(Set.new(@kb.libraries.map { |_, c| c['cookbook'] })) | ||
cookbooks.subtract(Set.new(@kb.resources.map { |_, c| c['cookbook'] })) | ||
cookbooks.subtract(Set.new(@kb.providers.map { |_, c| c['cookbook'] })) | ||
cookbooks.to_a.sort | ||
end | ||
|
||
def output | ||
to_a | ||
end |
22 changes: 22 additions & 0 deletions
22
cookbooks/fb_bookworm/files/default/bookworm/rules/AttributeExists.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2022-present, Meta, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
description 'Helper rule to show existence of an attributes file' | ||
keys %w{ | ||
attribute | ||
} | ||
|
||
def output | ||
true | ||
end |
22 changes: 22 additions & 0 deletions
22
cookbooks/fb_bookworm/files/default/bookworm/rules/LibraryExists.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2022-present, Meta, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
description 'Helper rule to show existence of a library file' | ||
keys %w{ | ||
library | ||
} | ||
|
||
def output | ||
true | ||
end |
22 changes: 22 additions & 0 deletions
22
cookbooks/fb_bookworm/files/default/bookworm/rules/MetadatarbExists.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2022-present, Meta, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
description 'Helper rule to show existence of a metadata.rb file' | ||
keys %w{ | ||
metadatarb | ||
} | ||
|
||
def output | ||
true | ||
end |
22 changes: 22 additions & 0 deletions
22
cookbooks/fb_bookworm/files/default/bookworm/rules/ProviderExists.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2022-present, Meta, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
description 'Helper rule to show existence of a provider file' | ||
keys %w{ | ||
provider | ||
} | ||
|
||
def output | ||
true | ||
end |
22 changes: 22 additions & 0 deletions
22
cookbooks/fb_bookworm/files/default/bookworm/rules/RecipeExists.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2022-present, Meta, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
description 'Helper rule to show existence of a recipe' | ||
keys %w{ | ||
recipe | ||
} | ||
|
||
def output | ||
true | ||
end |
22 changes: 22 additions & 0 deletions
22
cookbooks/fb_bookworm/files/default/bookworm/rules/ResourceExists.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2022-present, Meta, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
description 'Helper rule to show existence of a resource file' | ||
keys %w{ | ||
resource | ||
} | ||
|
||
def output | ||
true | ||
end |